-
Notifications
You must be signed in to change notification settings - Fork 180
♻️ refactor(command palette): make common custom hook for Table and Column options #3755
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Finished running flow.
|
|
Updates to Preview Branch (refact/table-options-common-logic) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
WalkthroughIntroduces useTableOptionSelect hook to centralize table/column selection, click, and Enter/Meta+Enter behavior in the ERD Command Palette. Refactors TableOptions and TableColumnOptions to use the hook. Adds dedicated test suites for the hook and TableColumnOptions. No production logic added beyond the new hook and integration. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant CP as CommandPalette (UI)
participant H as useTableOptionSelect (hook)
participant TS as useTableSelection
participant W as Window/Location
rect rgb(245,248,255)
note right of H: New centralized flow
U->>CP: Click or Enter on suggestion
CP->>H: optionSelectHandler / key handler
alt Meta/Ctrl pressed
H->>W: window.open(ERD link)
H->>CP: setOpen(false)
else No modifier
H->>TS: selectTable(tableId, displayArea='main')
opt Column suggestion
H->>W: update location.hash (#table__columns__column)
end
H->>CP: setOpen(false)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
52efb02 to
7324f77
Compare
Check changeset necessityStatus: NOT REQUIRED Reason:
Changeset (copy & paste):# No changeset required for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring!!
Issue
Why is this change needed?
As I mentioned in #3732 (comment),
TableOptionscomponent andTableColumnOptionscomponent shares the same logics. This PR will createuseTableOptionSelectcustom hook by extracting the logics to make the implementation simpler.I forgot to add tests for
TableColumnOptionscomponent in #3732, so I added it before touching its codes to avoid regressions.Summary by CodeRabbit
Refactor
Tests