-
Notifications
You must be signed in to change notification settings - Fork 2
ENG-947 dragging and/or clicking on section header crashes the sidebar #481
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
This pull request has been ignored for the connected project Preview Branches by Supabase. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
const initialConfig = useConfig(); | ||
const [config, setConfig] = useState(initialConfig); | ||
|
||
useEffect(() => { |
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.
Need this to update the state of sections if we add new section or move the sections we want this to render that state
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.
This is a bad pattern because it has two layers of state management, useConfig and useEffect.
Try this:
const { config, setConfig } = useConfig();
and modify useConfig()
to also return setConfig
(and remove the useEffect
)
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughUpdates adjust click handling in PersonalSectionItem to only toggle when children exist and remove the fallback open action. LeftSidebarView gains an effect to synchronize local config state with changes to initialConfig by invoking setConfig(initialConfig). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant PSI as PersonalSectionItem
participant LSV as LeftSidebarView
participant State as Config State
rect rgba(200,230,255,0.3)
note over PSI: Title click behavior
User->>PSI: Click title
alt Has children
PSI->>PSI: handleChevronClick()
else No children
PSI-->>User: No action
end
end
rect rgba(220,255,220,0.3)
note over LSV,State: Sync initialConfig -> config
LSV->>LSV: useEffect(dep: initialConfig)
LSV->>State: setConfig(initialConfig)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (2)
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 |
const initialConfig = useConfig(); | ||
const [config, setConfig] = useState(initialConfig); | ||
|
||
useEffect(() => { |
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.
This is a bad pattern because it has two layers of state management, useConfig and useEffect.
Try this:
const { config, setConfig } = useConfig();
and modify useConfig()
to also return setConfig
(and remove the useEffect
)
Summary by CodeRabbit
Bug Fixes
Refactor