-
Notifications
You must be signed in to change notification settings - Fork 15.4k
fix: database model Collapse state #34126
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
This reverts commit 35aaeb6.
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.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Unnecessary State Updates in useEffect ▹ view | ✅ Fix detected |
Files scanned
File Path | Reviewed |
---|---|
superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx | ✅ |
superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
const [activeKey, setActiveKey] = useState<string[] | undefined>(); | ||
|
||
useEffect(() => { | ||
if (!expandableModalIsOpen) { | ||
setActiveKey(undefined); | ||
} | ||
}, [expandableModalIsOpen]); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
LGTM!
SUMMARY
The problem is that the Collapse component from the Ant Design library retains its state (such as an open panel) even after closing and reopening the modal window. This is because React does not destroy the component when the modal window is closed, but simply hides it. As a result, the Collapse state is preserved.
To solve this problem, you need to reset the Collapse state every time you open the modal window, which is what this PR solves
continuation of PR #32734
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION