-
Notifications
You must be signed in to change notification settings - Fork 116
Database duplicate test #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideAdds real-time folder outline diff handling (including BroadcastChannel and WebSocket plumbing) and RID-based de‑duplication, refactors page/space actions to rely on these notifications instead of manual outline reloads, adjusts the app outline HTTP API to return folder metadata, and introduces Cypress/integration tests to verify sidebar refresh, cross-tab sync, and cloud database duplication. Sequence diagram for folder outline change propagation via WebSocket and BroadcastChannelsequenceDiagram
participant Server
participant WebSocketClient as WebSocket_client
participant BroadcastChannel as Broadcast_channel
participant SyncHook as useSync
participant EventEmitter as eventEmitter
participant WorkspaceData as useWorkspaceData
participant BusinessLayer as AppBusinessLayer
participant Sidebar as Sidebar_UI
rect rgb(235,235,255)
Server->>Server: Folder state change
Server-->>WebSocketClient: WorkspaceNotification(folderChanged)
end
WebSocketClient-->>SyncHook: wsNotification.folderChanged
SyncHook->>EventEmitter: emit(APP_EVENTS.FOLDER_OUTLINE_CHANGED, FolderChanged)
par In_current_tab
EventEmitter-->>WorkspaceData: FOLDER_OUTLINE_CHANGED(FolderChanged)
WorkspaceData->>WorkspaceData: parseFolderRid(folderRid)
WorkspaceData->>WorkspaceData: compareFolderRid(patchRid, lastFolderRidRef)
alt stale_or_equal_RID
WorkspaceData-->>Sidebar: no_update
else newer_RID
alt no_outlineDiffJson
WorkspaceData->>WorkspaceData: loadOutline(workspaceId, force=false)
WorkspaceData->>Sidebar: setOutline(full_outline)
else has_outlineDiffJson
WorkspaceData->>WorkspaceData: JSON.parse(outlineDiffJson)
WorkspaceData->>WorkspaceData: isOnlyNonVisualOutlineChange(patch)
alt only_non_visual_changes
WorkspaceData->>WorkspaceData: updateLastFolderRid(patchRid)
else visual_changes
WorkspaceData->>WorkspaceData: applyPatch({outline}, patch)
WorkspaceData->>Sidebar: setOutline(patched_outline)
WorkspaceData->>EventEmitter: emit(APP_EVENTS.OUTLINE_LOADED, patched_outline)
WorkspaceData->>WorkspaceData: updateLastFolderRid(patchRid)
end
end
end
and Cross_tab_via_BroadcastChannel
WebSocketClient-->>BroadcastChannel: broadcast FolderChanged
BroadcastChannel-->>SyncHook: bcNotification.folderChanged
SyncHook->>EventEmitter: emit(APP_EVENTS.FOLDER_OUTLINE_CHANGED, FolderChanged)
EventEmitter-->>WorkspaceData: FOLDER_OUTLINE_CHANGED(FolderChanged)
WorkspaceData->>WorkspaceData: same_RID_and_patch_logic_as_above
WorkspaceData-->>Sidebar: sidebar_updated_in_other_tab
end
rect rgb(235,255,235)
EventEmitter-->>BusinessLayer: FOLDER_OUTLINE_CHANGED
BusinessLayer->>BusinessLayer: skipNextFolderOutlineRefreshRef = true
BusinessLayer->>BusinessLayer: skipNextFolderOutlineRefreshUntilRef = now + TTL
BusinessLayer->>Sidebar: prevent_duplicate_refresh_after_collab_update
end
Class diagram for notification.FolderChanged and related outline typesclassDiagram
class notification_WorkspaceNotification {
<<message>>
+profileChange
+permissionChanged
+sectionChanged
+shareViewsChanged
+mentionablePersonListChanged
+serverLimit
+workspaceMemberProfileChanged
+folderChanged : notification_FolderChanged
+payload : enum
}
class notification_FolderChanged {
<<message>>
+outlineDiffJson : string
+folderRid : string
+_folderRid : string
+create(properties)
+encode(message, writer)
+encodeDelimited(message, writer)
+decode(reader, length)
+decodeDelimited(reader)
+verify(message)
+fromObject(object)
+toObject(message, options)
+toJSON()
+getTypeUrl(typeUrlPrefix)
}
class AppOutlineResponse {
+outline : View[]
+folderRid : string
}
class View {
+folder_rid : string
+view_id : string
+name : string
+icon
+extra : ViewExtra
}
notification_WorkspaceNotification --> notification_FolderChanged : folderChanged
AppOutlineResponse --> View : outline
class ViewExtra {
}
View --> ViewExtra : extra
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Description
Checklist
General
Testing
Feature-Specific
Summary by Sourcery
Add folder outline change notifications with diff-based sidebar updates, enhance duplication and page actions UX, and update HTTP API outline responses to include folder revision IDs.
New Features:
Enhancements:
Build:
Tests:
Chores: