Sy 4118 improve mosaic tab rename syncrhonization#2266
Open
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (19.32%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## rc #2266 +/- ##
==========================================
- Coverage 63.92% 63.82% -0.11%
==========================================
Files 2156 2152 -4
Lines 109353 109174 -179
Branches 8298 8288 -10
==========================================
- Hits 69906 69678 -228
- Misses 33425 33475 +50
+ Partials 6022 6021 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…8-improve-mosaic-tab-rename-syncrhonization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Pull Request
Linear Issue
SY-####
Description
Basic Readiness
Greptile Summary
This PR replaces the
useSyncNamepush-based hook with a renderer-ownedNameHookpattern: each renderer (LinePlot, Log, Table, Schematic, Arc, Range Overview, Task Form) exposes a staticuseNameproperty, and a newCustomTabNamecomponent inMosaic.tsxcalls it to subscribe to remote name changes and propagate user-initiated tab renames back to the server. NewuseRetrieveObservableNamehooks are added across all pluto query modules to subscribe to live resource name changes via the existing flux observable infrastructure.Confidence Score: 4/5
Safe to merge with awareness of the previously flagged workspace-sync gap in LinePlot's inline title path.
Score is capped at 4 by the previously-flagged P1 (handleTitleChange in LinePlot.tsx replacing syncDispatch with plain dispatch, dropping multi-window workspace sync for inline title edits). The new NameHook architecture is well-structured, the prior broken-guard bugs are fixed, and new integration tests cover both rename directions.
console/src/lineplot/LinePlot.tsx (handleTitleChange workspace sync), console/src/hardware/common/task/Form.tsx (useName declaration order)
Important Files Changed
Sequence Diagram
sequenceDiagram participant Remote as Server (Remote) participant RN as useRetrieveObservableName participant TN as TabName / CustomTabName participant Dispatch as Redux (Layout slice) participant DP as Tabs.DefaultName note over TN: Mount – TabName detects renderer.useName TN->>RN: useName(tabKey, handleNameChange) note over TN: useEffect fires retrieve() TN->>Remote: retrieve({ key: tabKey }) Remote-->>RN: onChange(result) → result.data.name RN-->>Dispatch: handleNameChange → Layout.rename note over DP: User edits tab name inline DP->>TN: handleRename(key, newName) TN->>Dispatch: dispatch(Layout.rename) TN->>Remote: hookOnRename(newName) → useRename.update note over Remote: External rename (e.g., another window) Remote-->>RN: observable fires with new name RN-->>Dispatch: handleNameChange → Layout.renameComments Outside Diff (4)
console/src/arc/editor/Editor.tsx, line 11-12 (link)arcwas renamed toa, and the same pattern appears inLog.tsx(log→l) andTable.tsx(table→t). These one-letter names make the code harder to scan — the original descriptive names conveyed the type at a glance.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
console/src/layout/useSyncName.spec.tsxuseSyncName.spec.tsxis removed along with the hook it tested, but no tests for the newNameHook/CustomTabName/useNamepattern are added. The prior tests covered the two-way sync (remote → layout slice and layout state → remote). These paths are now handled by each renderer'suseNamehook and byCustomTabName'shandleNameChange/handleRename, neither of which has coverage.console/src/hardware/common/task/Form.tsx, line 83-85 (link)retrievesilently no-ops whentaskKeyis nullWhen the task hasn't been persisted yet (
taskKey == null),retrieve()returns without fetching, soonChangeis never called and the tab name stays at whatever value the layout slice already has. This is probably intentional, but the asymmetry with otheruseNamehooks (which always callbaseRetrieve) could cause the tab name to be stale if the task key becomes available after the component mounts — the observable won't start until the next retrieve.console/src/lineplot/LinePlot.tsx, line 449-453 (link)handleTitleChangedrops workspace syncsyncDispatchwas replaced with plaindispatch. ThesyncDispatchvariant propagatesLayout.renameacross windows (multi-window workspace sync); plaindispatchis local-only. When the plot's inline title editor is used to rename the layout the workspace will no longer be notified, causing the name to diverge between open windows.Previously
syncDispatch(Layout.rename(...))handled both local update and workspace propagation in one call. Now onlydispatch(local) andrenameRemote(server resource) are called — the workspace sync path is missing for this code path.Reviews (5): Last reviewed commit: "updated console names" | Re-trigger Greptile