-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: websockets calling on_new_release across all sessions upon new websocket connection. #16339
Conversation
…ss all active sessions when a new websocket connection is established.
Changes not needed to websocket.ts - was bouncing between ideas, current implementation doesn't need this to change.
If you wanted it to persist instead of only being stored per tab you can switch to localStorage, however I'd advise against this personally unless we implement functionality to trigger the popup again after a set time (can be done by setting modalAcknowledged to false or a non truthy value). |
With this logic, once you acknowledge the changes for one release, when the next release happens, the modal won't show, correct? |
Correct. I've specifically chosen to use session storage over local storage for this reason; Once the tab is closed, the popup will continue to reappear. |
Ah I didn't see that. Thanks for the explaination |
I share your concern if it was ever moved out of session storage (into local), but I think as a temporary measure it should suffice. Svelte isn't a framework i'm hugely familiar with, but if you think a revised timer-based dismisser would be worth it I'd be happy to work on it when I get the chance. Eg, a setting in the admin panel that lets the user define how long a dismissed modal will stay dismissed for. That would carry over across all sessions, so we'd need logic to enable the modal to reappear after a specified time. |
Description
Added a new variable
modalAcknowledged
to session storage to check against before displaying the new_release window/popup.Flow of operations
Modal not acknowledged:
Modal acknowledged
The same thing could be achieved within the handleRelease() function should you want that to be called
though I think having it in it's current implementation is better, as it avoids the function being called at all if the modals been acknowledged.
Why is this change required? What problem does it solve?
Whenever a new websocket connection is made, and an update for the server is available, the update window pops up on ALL active web sessions. An example would be:
The same would happen if you opened another immich tab. I believed this to be down to version-announcement-box.svelte being ran whenever ANY new websocket connection is made (I could be wrong, I am tired). In any case, the provided PR should fix the issue.
Fixes issues:
Fixes #14009
How Has This Been Tested?
Within /web:
npm run test
Before I made any changes, the output were as follows:
Test Files 16 failed | 19 passed (35) Tests 55 failed | 94 passed (149) Start at 06:49:49 Duration 5.36s (transform 4.41s, setup 16.20s, collect 7.14s, tests 5.28s, environment 26.42s, prepare 4.15s)
The failed files were mostly to do with languages.
After I made my changes, the output is as follows:
Test Files 16 failed | 19 passed (35) Tests 55 failed | 94 passed (149) Start at 07:48:54 Duration 4.93s (transform 3.83s, setup 14.23s, collect 6.78s, tests 4.89s, environment 23.68s, prepare 4.09s)
npm run check:all
[warn] Code style issues found in 511 files. Run Prettier with --write to fix.
The only changed file in this PR is NOT listed in these files.
Checklist:
src/services
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services
)Please let me know if I've had any oversights, I'll be happy to amend any issues :)