Skip to content

Regularly check if updates are available on a remote and notify user#469

Merged
Freymaurer merged 5 commits intonfdi4plants:developerfrom
Thyra:auto-sync-pull
Dec 3, 2025
Merged

Regularly check if updates are available on a remote and notify user#469
Freymaurer merged 5 commits intonfdi4plants:developerfrom
Thyra:auto-sync-pull

Conversation

@Thyra
Copy link
Copy Markdown
Contributor

@Thyra Thyra commented Dec 3, 2025

Related to #450 . I hope it'll prevent some annoying merge conflicts 😊

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

Not sure why the PR also shows commits which are already in the developer branch?

@Freymaurer
Copy link
Copy Markdown
Collaborator

Code you do a clean PR? there seems to be an issue in your rebase? 😅

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

Yeah let me try

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

done :-)

Copy link
Copy Markdown
Collaborator

@Freymaurer Freymaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like how the checkRemoteDirtyStatus is called from vue

I propose two changes:

  1. Call the interval function inside onMounted
let timer: number | undefined;

onMounted(() => {
  timer = window.setInterval(() => {
    // side effect here
    console.log("tick");
  }, 1000);
});

onUnmounted(() => {
  clearInterval(timer);
});
  1. A dialog is used to interupt the user in its workflow and awaiting input or notifying of must check changes. I do not think we should call this without user based trigger. Instead please use a "notify" https://quasar.dev/quasar-plugins/notify#introduction

And do not subscribe a watcher to AppProperties.has_dirty_remote. instead just call the notify spawn function directly from the interval if checkRemoteDirtyStatus returns true. Do not save the property somewhere if we do not use it anymore.

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

Hey, thanks again for the quick feedback! 🙂.

  1. It is already called from inside onMounted; I can clear it on unMount but I think when App.vue unmounts the application closes anyway.
  2. We can't just notify from the interval because then it would re-notify every 5 minutes until changes are pulled.

Dialog vs Floating notification is a bit more subjective, I went for an interruption with dialog mainly for two reasons:

  1. If the user has a different window open and the ARCitect only in the background, they will miss a floating notification which disappears by itself.
  2. I think it is actually kind of important to interrupt your work and consciously decide how you want to handle the situation, if you just continue to work you risk merge conflicts. I don't find it too obtrusive since you only need to acknowledge it once (or if you open the ARC again later).

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

@Brilator If you have some time to try this version, I'd be curious as well what you say re user experience

@Freymaurer
Copy link
Copy Markdown
Collaborator

If the user has a different window open and the ARCitect only in the background, they will miss a floating notification which disappears by itself.

That the user might miss this if the ARCitect is running in the background is a good point, but we still can set the notify timeout to infinite:
image

then it will require user interaction without blocking the user for action. And a red banner on the bottom left will always draw attention

We can't just notify from the interval because then it would re-notify every 5 minutes until changes are pulled.

Again good point. Then maybe we just store the notify return value as reactive property:

image

This can also be used to close the notify object:

image

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

Ok I'll concede on the notification vs dialog ;-).

image

I think a flag in the AppProperties still makes the most sense though because it is a global state and used in multiple places (notification from the App.vue, the little exclamation point in the left side menu, updated from the GitSync view: if you do pull, you don't want to wait 5 minutes for the next interval until the little exclamation point disappears).

@Freymaurer
Copy link
Copy Markdown
Collaborator

Agreed! I like the idea of the exclamation mark on the left!

Can you center the icon? Then we can merge

image

@Thyra
Copy link
Copy Markdown
Contributor Author

Thyra commented Dec 3, 2025

image

Copy link
Copy Markdown
Collaborator

@Freymaurer Freymaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Freymaurer Freymaurer merged commit 5c6faef into nfdi4plants:developer Dec 3, 2025
@Thyra Thyra deleted the auto-sync-pull branch December 3, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants