Repository navigation
fix(ui): useDocumentDrawer always reports the drawer as closed - #19235
digitalwerber wants to merge 1 commit into
Conversation
`useDocumentDrawer` returned a hardcoded `isDrawerOpen: false` to avoid re-renders. Consumers rely on it: the relationship table resets the current document id once its drawer closes, and the relationship field disables its select while the drawer is open. Because the id was never reset, the edit drawer of a join field row did not open again after it was closed. Derive `isDrawerOpen` from the modal state of the drawer's own slug. The hook already subscribes to the modal context, so this adds no subscription, and the memoized state only changes when this drawer opens or closes.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Track drawer state and verify reopening packages/ui/src/elements/DocumentDrawer/index.tsx, test/joins/e2e.spec.ts |
useDocumentDrawer reads the open state for its drawer slug and includes that state in its memoized context. The end-to-end test verifies that the drawer and title input are visible after reopening. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: jarrodmflesch, jessrynkar
Merge Risk: 
Minimal · up to c5b71
-
The PR addresses the reported drawer reopening issue and adds coverage for the affected workflow.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#19232requiresuseDocumentDrawerto report the open state for its own drawer.packages/ui/src/elements/DocumentDrawer/index.tsxderivesisDrawerOpenfrommodalState[drawerSlug]?.isOpenand includes it in the memoized state dependencies. The added join E2E coverage verifies that a row drawer closes and reopens.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
What?
useDocumentDrawernow derivesisDrawerOpenfrom the modal state of its own drawer slug instead of returning a hardcodedfalse.Why?
Consumers rely on it. The relationship table resets its current document id when the drawer closes, and the relationship field disables its select while the drawer is open. With
falsehardcoded, the edit drawer of a join field row never opened a second time.How?
The hook already subscribes to the modal context, so this adds no subscription; the memoized drawer state only changes when this drawer opens or closes. Adds an e2e test in
test/joinsthat opens, closes and reopens a row's drawer.Fixes #19232