From 6aab255096ce49342e10bc7f96485d6ce6e3e97b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 21 Sep 2025 19:23:41 +0000 Subject: [PATCH] fix(web): update shared link expiration in UI without full refresh This commit fixes a UI bug where the expiration date of a shared link was not updating correctly after being edited. The `SharedLinkCreateModal` is modified to return the updated shared link data upon successful edit. The parent page now uses this data to update its local state directly, avoiding a full page refresh and providing a better user experience. --- web/src/lib/modals/SharedLinkCreateModal.svelte | 4 ++-- .../routes/(user)/shared-links/[[id=id]]/+page.svelte | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/web/src/lib/modals/SharedLinkCreateModal.svelte b/web/src/lib/modals/SharedLinkCreateModal.svelte index 88f603c16b..3971b91fac 100644 --- a/web/src/lib/modals/SharedLinkCreateModal.svelte +++ b/web/src/lib/modals/SharedLinkCreateModal.svelte @@ -103,7 +103,7 @@ try { const expirationDate = expirationOption > 0 ? DateTime.now().plus(expirationOption).toISO() : null; - await updateSharedLink({ + const updatedLink = await updateSharedLink({ id: editingLink.id, sharedLinkEditDto: { description, @@ -121,7 +121,7 @@ message: $t('edited'), }); - onClose(); + onClose(updatedLink); } catch (error) { handleError(error, $t('errors.failed_to_edit_shared_link')); } diff --git a/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte b/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte index ea1c47f0f8..e37301300e 100644 --- a/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte +++ b/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte @@ -54,8 +54,15 @@ } }; - const handleEditDone = async () => { - await refresh(); + const handleEditDone = async (updatedLink?: SharedLinkResponseDto) => { + if (updatedLink) { + const index = sharedLinks.findIndex((link) => link.id === updatedLink.id); + if (index !== -1) { + sharedLinks[index] = updatedLink; + } + } else { + await refresh(); + } await goto(AppRoute.SHARED_LINKS); };