fix: linked records redirection (#4312)
Closes: #4093 --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -67,7 +67,12 @@ export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
|
||||
|
||||
return apolloRef.current.getClient();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [setTokenPair, isDebugMode, currentWorkspace?.currentCacheVersion, setPreviousUrl]);
|
||||
}, [
|
||||
setTokenPair,
|
||||
isDebugMode,
|
||||
currentWorkspace?.currentCacheVersion,
|
||||
setPreviousUrl,
|
||||
]);
|
||||
|
||||
useUpdateEffect(() => {
|
||||
if (isDefined(apolloRef.current)) {
|
||||
|
||||
@ -11,6 +11,7 @@ import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||
import { UPDATE_VIEW_BUTTON_DROPDOWN_ID } from '@/views/constants/UpdateViewButtonDropdownId';
|
||||
import { useViewFromQueryParams } from '@/views/hooks/internal/useViewFromQueryParams';
|
||||
import { useViewStates } from '@/views/hooks/internal/useViewStates';
|
||||
import { useGetCurrentView } from '@/views/hooks/useGetCurrentView';
|
||||
import { useSaveCurrentViewFiltersAndSorts } from '@/views/hooks/useSaveCurrentViewFiltersAndSorts';
|
||||
@ -74,7 +75,11 @@ export const UpdateViewButtonGroup = ({
|
||||
await saveCurrentViewFilterAndSorts();
|
||||
};
|
||||
|
||||
if (!canPersistView) {
|
||||
const { hasFiltersQueryParams } = useViewFromQueryParams();
|
||||
|
||||
const canShowButton = canPersistView && !hasFiltersQueryParams;
|
||||
|
||||
if (!canShowButton) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import { DropdownScope } from '@/ui/layout/dropdown/scopes/DropdownScope';
|
||||
import { EditableFilterDropdownButton } from '@/views/components/EditableFilterDropdownButton';
|
||||
import { EditableSortChip } from '@/views/components/EditableSortChip';
|
||||
import { ViewBarFilterEffect } from '@/views/components/ViewBarFilterEffect';
|
||||
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';
|
||||
@ -105,6 +106,7 @@ export const ViewBarDetails = ({
|
||||
const { currentViewWithCombinedFiltersAndSorts } = useGetCurrentView();
|
||||
|
||||
const isViewBarExpanded = useRecoilValue(isViewBarExpandedState);
|
||||
const { hasFiltersQueryParams } = useViewFromQueryParams();
|
||||
const canPersistView = useRecoilValue(canPersistViewSelector());
|
||||
const availableFilterDefinitions = useRecoilValue(
|
||||
availableFilterDefinitionsState,
|
||||
@ -114,6 +116,7 @@ export const ViewBarDetails = ({
|
||||
);
|
||||
|
||||
const { resetCurrentView } = useResetCurrentView();
|
||||
const canResetView = canPersistView && !hasFiltersQueryParams;
|
||||
|
||||
const handleCancelClick = () => {
|
||||
resetCurrentView();
|
||||
@ -176,7 +179,7 @@ export const ViewBarDetails = ({
|
||||
</StyledAddFilterContainer>
|
||||
)}
|
||||
</StyledFilterContainer>
|
||||
{canPersistView && (
|
||||
{canResetView && (
|
||||
<StyledCancelButton
|
||||
data-testid="cancel-button"
|
||||
onClick={handleCancelClick}
|
||||
|
||||
@ -59,7 +59,9 @@ export const useViewFromQueryParams = () => {
|
||||
[queryParamsValidation],
|
||||
);
|
||||
|
||||
const hasFiltersQueryParams = filterQueryParams;
|
||||
const hasFiltersQueryParams =
|
||||
isDefined(filterQueryParams) &&
|
||||
Object.entries(filterQueryParams).length > 0;
|
||||
|
||||
const getFiltersFromQueryParams = useRecoilCallback(
|
||||
({ snapshot }) =>
|
||||
|
||||
Reference in New Issue
Block a user