A swath of UI bug fixes and small improvements#2018
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughAdds backend error-handling for CRDT HTTP sync using ApiResponse and a new CrdtSyncException. Introduces a root-location service and centralizes routing into AppRoutes. Enhances rich-text editor paste/selection and commit behaviors. Adjusts sync UI components and sizing. Tweaks project resource initialization timing and switches stats to debounce. Minor styling updates. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
C# Unit Tests130 tests 130 ✅ 19s ⏱️ Results for commit 405355a. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
frontend/viewer/src/project/tasks/SubjectPopup.svelte (1)
67-74: Defensive fix for rich-text handler timing.The blur/tick pattern ensures change handlers complete before subject processing. This prevents errors from handlers firing too late (e.g., during onDestroy).
Optional refinement: Consider narrowing the blur condition to specifically target rich-text editors:
- if (document.activeElement instanceof HTMLElement) { + if (document.activeElement instanceof HTMLElement && + (document.activeElement.classList.contains('ProseMirror') || + document.activeElement.contentEditable === 'true')) {This would avoid blurring non-rich-text form elements, though the current broad approach is safer for ensuring all handlers complete.
frontend/viewer/src/AppRoutes.svelte (1)
55-57: Use onMount+tick for fallback redirects
Imperative redirects in svelte-routing should live in a component’s onMount hook – wrap navigate('/', { replace: true }) inside onMount (with await tick() or requestAnimationFrame) rather than inline setTimeout.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
.vscode/settings.json(1 hunks)backend/FwLite/LcmCrdt/RemoteSync/CrdtHttpSyncService.cs(2 hunks)backend/FwLite/LcmCrdt/RemoteSync/CrdtSyncException.cs(1 hunks)frontend/viewer/.storybook/decorators/FWLiteDecorator.svelte(2 hunks)frontend/viewer/src/App.svelte(2 hunks)frontend/viewer/src/AppRoutes.svelte(1 hunks)frontend/viewer/src/lib/components/lcm-rich-text-editor/lcm-rich-text-editor.svelte(6 hunks)frontend/viewer/src/lib/components/stomp/stomp-safe-lcm-rich-text-editor.svelte(1 hunks)frontend/viewer/src/lib/project-context.svelte.ts(2 hunks)frontend/viewer/src/lib/project-stats.ts(1 hunks)frontend/viewer/src/lib/services/root-location-service.ts(1 hunks)frontend/viewer/src/project/sync/FwLiteToFwMergeDetails.svelte(2 hunks)frontend/viewer/src/project/sync/SyncArrow.svelte(1 hunks)frontend/viewer/src/project/sync/SyncStatusPrimitive.svelte(1 hunks)frontend/viewer/src/project/tasks/DoneView.svelte(1 hunks)frontend/viewer/src/project/tasks/SubjectPopup.svelte(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/viewer/src/lib/project-context.svelte.ts (1)
frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts (1)
IMiniLcmJsInvokable(24-69)
backend/FwLite/LcmCrdt/RemoteSync/CrdtHttpSyncService.cs (1)
backend/FwLite/LcmCrdt/RemoteSync/CrdtSyncException.cs (3)
CrdtSyncException(3-17)CrdtSyncException(9-12)CrdtSyncException(13-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build API / publish-api
- GitHub Check: Build UI / publish-ui
- GitHub Check: Build FwHeadless / publish-fw-headless
- GitHub Check: check-and-lint
- GitHub Check: frontend-component-unit-tests
- GitHub Check: Build FW Lite and run tests
- GitHub Check: Analyze (csharp)
🔇 Additional comments (21)
.vscode/settings.json (1)
47-49: Appreciate the search noise reduction.Excluding
distdirectories from search keeps editor results focused on source files. Looks good.frontend/viewer/src/project/tasks/DoneView.svelte (1)
53-53: LGTM! Proper contrast pairing added.Adding
text-primary-foregroundensures proper text contrast against thebg-primarybackground, fixing a potential readability/accessibility issue.frontend/viewer/src/lib/project-stats.ts (1)
18-18: Good improvement to stats update behavior.Switching from
throttle: 3000todebounce: 500improves responsiveness—stats now update 500ms after user activity stops rather than at fixed 3-second intervals. This is more efficient for burst updates and provides faster feedback after editing entries.frontend/viewer/src/project/tasks/SubjectPopup.svelte (1)
18-18: LGTM!The
tickimport is correctly added to support the new async blur/tick pattern in theonNextfunction.frontend/viewer/src/lib/components/lcm-rich-text-editor/lcm-rich-text-editor.svelte (5)
2-2: LGTM!The additional imports (
FragmentandSlice) are correctly added to support the new paste handling logic.
57-58: LGTM!Converting
dirtyto a plain variable avoids timing issues when blur occurs during navigation, as explained in theonblurcomment. The logic correctly tracks whetheronchangeshould be called.
157-166: LGTM!The defensive checks and error handling properly address edge cases where the field is cleared or selection restoration fails on older devices. The fallback behavior is sound.
178-180: LGTM!The comment clearly explains the timing constraint that prevents state updates during navigation-triggered blur events. This complements the
dirtyvariable change.
230-234: LGTM!The Backspace handler correctly prevents errors when the document is empty by returning
trueto indicate the keypress was handled. This is good defensive programming for older devices.frontend/viewer/src/project/sync/FwLiteToFwMergeDetails.svelte (1)
72-72: LGTM: Size adjustment aligns with SyncArrow refactor.The reduction from
1.5to1.25is a straightforward visual tuning that follows the updated scaling logic introduced inSyncArrow.svelte.Also applies to: 81-81
frontend/viewer/.storybook/decorators/FWLiteDecorator.svelte (1)
32-33: LGTM: Storybook integration with root-location service.Using
readable()as a stub RootLocation is appropriate for Storybook, where real routing is not available.Also applies to: 44-44
frontend/viewer/src/lib/project-context.svelte.ts (1)
133-149: LGTM: Explicit initialization for throttled resources.The logic ensures that throttled resources load when the API becomes available, avoiding the swallowed-refetch issue described in the comment. The approach handles both immediate and deferred API availability.
Note: Error handling via
.catch(console.error)is minimal but aligns with existing patterns in this module.frontend/viewer/src/project/sync/SyncArrow.svelte (1)
12-19: LGTM: Sizing refactor improves clarity and correctness.Introducing the
headSizeconstant and explicit scaling logic makes the component more maintainable and removes previous hardcoded adjustments. The SVGpreserveAspectRatioattribute ensures correct rendering across scale factors.Also applies to: 26-26
frontend/viewer/src/App.svelte (1)
5-5: LGTM: Routing centralized into AppRoutes.Moving routing logic out of
App.svelteinto a dedicatedAppRoutescomponent improves separation of concerns and maintainability.Also applies to: 7-7, 17-19
frontend/viewer/src/lib/components/stomp/stomp-safe-lcm-rich-text-editor.svelte (3)
27-30: LGTM: Idle-time commit using untrack.The use of
untrack(commitAnyChanges)correctly invokes the commit function when the user is idle, without creating reactive dependencies inside the effect.
31-40: LGTM: Navigation-aware commit handling.The
onDestroyhook ensures pending changes are committed before unmounting and subscribes to location changes to handle navigation-related blur timing issues. The returned unsubscribe function is correctly used for cleanup.
44-46: LGTM: Centralized commit logic in onchange handler.The editor's
onchangecallback now invokescommitAnyChanges, which consolidates the dirty check and commit logic.frontend/viewer/src/lib/services/root-location-service.ts (2)
8-18: LGTM: Robust initialization with double-init protection.The function correctly prevents double initialization by throwing in development and logging a warning in production, ensuring the service is initialized exactly once per context.
20-23: LGTM: Fail-fast retrieval of RootLocation.The function correctly throws if the service is not initialized, ensuring consumers are aware of missing setup.
frontend/viewer/src/AppRoutes.svelte (2)
12-13: LGTM: Global initialization at app startup.Setting up error handlers and initializing the root location service at the top level of
AppRoutesensures these services are available before any routes are rendered.
16-54: LGTM: Route structure with remounting logic.Using
{#key}blocks ensures components are remounted when route parameters change, preventing stale state. The nestedRouterpattern is appropriate for the routing setup.
This gets us a consistent focus effect
So not lopsided on mobile
Debounce ensures we get the latest value
a5d05d2 to
405355a
Compare
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
I can't think of any known UI bugs that this doesn't cover.