feat(web-server): allow dismissing updates in the GUI (#5276) - #5449
fliptrigga13 wants to merge 1 commit into
Conversation
| clearUpdatesInterval(); | ||
| if (isUpdateDismissed(fetchedUpdateData.latestVersion)) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Dismissal Stops Future Polling
When polling finds a version already dismissed in localStorage, this code clears the interval before returning. Because the persistent sidebar has no other mechanism to restart polling, it will not detect a newer release during the same session, and the notification cannot automatically reappear until a reload or remount.
| useEffect(() => { | ||
| if (typeof window !== "undefined") { | ||
| const stored = localStorage.getItem("dismissedUpdateVersion"); | ||
| setDismissedVersion(stored); | ||
| } | ||
| }, [isOpen, latestVersion]); |
There was a problem hiding this comment.
If localStorage access throws a SecurityError, this effect lets the error escape whenever the component mounts. This bypasses the guarded storage helper and can unmount the application tree instead of gracefully treating the update as not dismissed.
| useEffect(() => { | |
| if (typeof window !== "undefined") { | |
| const stored = localStorage.getItem("dismissedUpdateVersion"); | |
| setDismissedVersion(stored); | |
| } | |
| }, [isOpen, latestVersion]); | |
| useEffect(() => { | |
| if (typeof window !== "undefined") { | |
| try { | |
| const stored = localStorage.getItem("dismissedUpdateVersion"); | |
| setDismissedVersion(stored); | |
| } catch { | |
| setDismissedVersion(null); | |
| } | |
| } | |
| }, [isOpen, latestVersion]); |
| onClick={() => { | ||
| clearDismissedUpdateVersion(); | ||
| setDismissedVersion(null); | ||
| toast.success("Update notification restored"); | ||
| }} |
There was a problem hiding this comment.
Restoring from the settings dialog only clears localStorage and updates that dialog's private state. The persistent sidebar is a separate component whose dismiss callback set its own updateAvailable state to false, so it receives no update and remains hidden until it remounts and fetches again.
Summary
Resolves #5276: Add an option to dismiss available updates from the GUI.
Problem
Previously, when an update was detected, Dokploy displayed a persistent "Update Available" button with ping indicator in the sidebar navigation with no way to dismiss it. Users who preferred not to install the update immediately had to either ignore the persistent button or update immediately.
Solution
apps/dokploy/lib/update.ts(isUpdateDismissed,dismissUpdateVersion,clearDismissedUpdateVersion,shouldShowUpdate) persisting dismissed version tags inlocalStorage.fetchedUpdateData.latestVersion !== dismissedVersion), the update notification automatically reappears.onDismisscallback toUpdateServerthat immediately hides the sidebar button and closes the dialog with toast notification.Test Plan
apps/dokploy/__test__/settings/update-dismiss.test.ts(10/10 passed).Closes #5276
The PR is not safe to merge until polling continues after dismissed versions, restricted-storage access is handled, and restoration updates the sidebar.
Summary
Reviews (1) · Last reviewed commit: "feat(web-server): allow dismissing updat..."