-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
View module refactor with atomic recoil component instance states #6810
View module refactor with atomic recoil component instance states #6810
Conversation
packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/hooks/useCombinedViewFilters.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/hooks/useCombinedViewSorts.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/hooks/useGetCurrentView.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFiltersAndSorts.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/views/states/currentViewIdComponentState.ts
Outdated
Show resolved
Hide resolved
...nty-front/src/modules/ui/utilities/state/component-state/hooks/useExtractedComponentState.ts
Outdated
Show resolved
Hide resolved
TODOs/FIXMEs:
|
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 pull request refactors the view module to implement atomic Recoil component instance states, focusing on improving state management and fixing issues with filter and sort persistence between page navigations.
- Introduces
useRecoilComponentValueV2
hook to replace various custom hooks for state management - Removes '-scope' suffix from component IDs for simplified and consistent state handling
- Updates
createComponentStateV2
tocreateComponentStateV2_alpha
for better instance context support - Refactors filter and sort dropdown components to use new state management approach
- Addresses issue Breadcrumbs Ignore Temporary Filters on Detail Page #6837 by improving temporary filter persistence during page navigation
30 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
Another masterpiece ;)
This PR refactors the view module to implement utils that avoid having to create hooks to inject the scope id in the states, like
useViewStates
, each componentState will know its unique related InstanceContext (which holds the instanceId), and thus will be able to retrieve it itself.We keep the naming componentState as it reflects the fact that those states are tied to instances of a component (or its children).
We introduce the instance word where it is needed, in place of scopeId for example, to precise the fact that we handle instances of component state, one for each instance of a component.
For example, the currentViewId is a state that is tied to an instance of the ViewBar, but as we can switch between views, we want currentViewId to be a componentState tied to an instance of the ViewBar component.
This PR also refactors view filter and sort states to fix this issue : #6837 and other problems involving resetting those states between page navigation.
Fixes #6837