Fixed view reset on view change (#6897)
Fixes #6833 The view states for unsaved changes were not reseted on view change. The fix was to just add a call to the existing resetCurrentView when the viewId changes in the related effect.
This commit is contained in:
@ -4,6 +4,7 @@ import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilte
|
||||
import { useViewFromQueryParams } from '@/views/hooks/internal/useViewFromQueryParams';
|
||||
import { useViewStates } from '@/views/hooks/internal/useViewStates';
|
||||
import { useGetCurrentView } from '@/views/hooks/useGetCurrentView';
|
||||
import { useResetCurrentView } from '@/views/hooks/useResetCurrentView';
|
||||
import { isUndefined } from '@sniptt/guards';
|
||||
import { useEffect } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
@ -33,6 +34,14 @@ export const QueryParamsViewIdEffect = () => {
|
||||
lastVisitedObjectMetadataItemId,
|
||||
);
|
||||
|
||||
const { resetCurrentView } = useResetCurrentView();
|
||||
|
||||
useEffect(() => {
|
||||
if (isDefined(currentViewId)) {
|
||||
resetCurrentView();
|
||||
}
|
||||
}, [resetCurrentView, currentViewId]);
|
||||
|
||||
useEffect(() => {
|
||||
const indexView = viewsOnCurrentObject.find((view) => view.key === 'INDEX');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user