Repository navigation
Studio: keep profile and appearance changes made in another window - #16580
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52116c5d0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (typeof window !== "undefined") { | ||
| window.addEventListener("storage", (event) => { | ||
| if (event.key === useUserProfileStore.persist.getOptions().name) { | ||
| void useUserProfileStore.persist.rehydrate(); |
There was a problem hiding this comment.
Preserve pending edits when another tab hydrates from the server
If tab A edits its name and tab B opens or reloads before A’s 800 ms debounced save runs, B’s usePersonalizationSync loads the old server record and persists it through useUserProfileStore.setState(nextProfile). This new listener imports that stale record into A, whose save-effect cleanup cancels the pending timer. Since the old value matches A’s saved baseline, neither tab saves the edit. Before this change, A retained its edit and its timer saved it. The appearance listener has the same interaction with server-driven replaceAll writes. Preserve or coordinate pending local changes before accepting another tab’s server hydration, and cover this case with both personalization sync hooks active.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reachable in practice. The other tab only loads from the server on page load or sign in, and that has to finish inside the 800 ms save debounce here, which a fresh Studio tab can't do. Leaving as is.
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
With Studio open in two tabs or windows, a change to the display name, nickname, picture, greeting or appearance (accent colour, fonts, layout) made in one tab was not picked up by the other. The other tab kept the old values in memory, and the next change made there (a nickname, the theme, the language) saved those old values back to the account. Signing in later, or on another device, showed the old name and the old colours, and the changes made in the first tab were lost.
The profile and the appearance customization now reload in every open tab when another tab changes them, the same way browser panel preferences already do. Each tab then saves the current values instead of outdated ones, and the new colours and fonts also show up in the other tab right away.
Screenshots
Before/after: a second open tab, no reload
Tab B sits on a new chat while tab A saves a custom greeting ("Hello from the other window") and a red accent. Tab B is then captured without reloading. Base 24d65c1 (left): tab B keeps "How can I help?" and the green accent (
--primary#17b88b). This PR at fc81b60 (right): tab B shows the new greeting and the red accent (#d0183c).