fix(library): modal close flash, rename of an empty library, toolbar spacing - #247
Conversation
The Modal reverted to open right after onClose, but the shelf closes the overview by a route change that unmounts it only later, so the dialog was drawn again for a beat. onClose may now return its promise and the Modal stays faded out until it settles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e new address A username-only save left the page on the old slug; with no library row yet the slug was the only proof of ownership, so it read as No such library. The page now moves to the new address and the account takes the new name in the same render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esktop Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @MaryWylde's task in 4m 10s —— View job Review complete
SummarySolid, well-scoped fix — three independent bugs, each with a minimal targeted change. No AGENTS.md violations (import order, aliases, component/barrel structure, no App Router/Tailwind/CSS-in-JS creep). Modal close flash ( Rename of an empty library ( Also worth flagging (not a code defect, a process one): the PR description says the rename path is not tested in a browser. This is exactly the kind of timing-sensitive router-event mechanism that's easy to get subtly wrong in practice, and per this repo's Library release-gate rules a missing verification should stay flagged rather than implicitly passing. Recommend running the described manual check (fresh account, empty library, username-only edit) before this merges. Toolbar spacing: the |
| if (onLibraryPage && freshUser.username) { | ||
| router.events.on('beforeHistoryChange', swap); | ||
| try { | ||
| await router.replace(libraryPath(freshUser.username), undefined, { | ||
| scroll: false, | ||
| }); | ||
| } catch (error) { | ||
| console.error('EditLibraryModal could not follow the rename:', error); | ||
| } finally { | ||
| router.events.off('beforeHistoryChange', swap); | ||
| } | ||
| } | ||
| swap(); |
There was a problem hiding this comment.
If router.replace rejects (e.g. a concurrent navigation cancels this one — the realistic case, since a failed getServerSideProps typically renders an error page rather than rejecting), the catch only logs and the unconditional swap() on line 222 still fires, so accountData.username moves to the new name while the URL is left on the old slug. That's the exact "name and address disagree" state this PR is fixing, just reachable again on the failure path.
Consider only swapping in the catch when you can confirm the address actually moved (e.g. check router.asPath against libraryPath(freshUser.username)), or surface an error instead of silently applying the rename to accountData.
What
onClose, but the shelf closes the overview through a URL change that removes it only once the route settles.onClosemay now return a promise, and the Modal stays faded out until it settles. Synchronous closes and guarded no-ops (delete in flight, a discard prompt) behave as before./library/<new-username>, and the account takes the new name in the same render as the new address, so nothing flashes. Libraries that already have a row also move to the new address now, instead of staying on a slug that fails on reload.Checks
tscare clean on the changed files.🤖 Generated with Claude Code