-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: RightDrawer doesn't save context values when clickedOutside #7729
Conversation
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.
PR Summary
This PR addresses an issue where the RightDrawer component wasn't saving context values when clicked outside, by implementing a debounced close function.
- Introduced debounced closeRightDrawer function in
packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawer.tsx
to prevent immediate closure - Modified click outside listener callback to use the debounced close function
- Imported debounce function from lodash to create the delayed closure mechanism
- Adjusted RightDrawer component to maintain state of inputs when clicking outside
- Resolved issue RightDrawer doesn't save context values when clickedOutside #7728 where cell container was clipping through the body on outside clicks
1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -9,7 +9,7 @@ import { | |||
useSetRecoilState, | |||
} from 'recoil'; | |||
import { Key } from 'ts-key-enum'; | |||
|
|||
import debounce from 'lodash.debounce'; |
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.
style: Consider using a more specific import to reduce bundle size
|
||
emitRightDrawerCloseEvent(); | ||
} | ||
}, | ||
[closeRightDrawer], | ||
[debouncedCloseRightDrawer], |
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.
logic: Update dependency array to include closeRightDrawer
Hello @harshit078, thank you for contributing :) Even if your solution works, I'm not sure that it is the right approach.
I'll let @charlesBochet and @lucasbordeau confirm though. |
/award 200 |
Awarding harshit078: 200 points 🕹️ Well done! Check out your new contribution on oss.gg/harshit078 |
@harshit078 We want to avoid debouncing as it is non deterministic. Could you try with |
@harshit078 When we need to debounce, it's generally a code smell because it means the underlying logic is too complex, we'll work on that to refactor this part, so the logic to persist a field can be deterministically and easily called before closing the right drawer. |
Thanks @harshit078 for your contribution! |
Sentry Issue: TWENTY-FRONT-2TZ |
Description
Changes
Screen.Recording.2024-10-16.at.3.08.48.AM.mov