This commit is contained in:
Charles Bochet 2024-12-12 19:17:58 +01:00
parent 3f9acacea7
commit b1e648a1ac
3 changed files with 2 additions and 23 deletions

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import { useRecoilValue, useSetRecoilState } from 'recoil'; import { useRecoilValue } from 'recoil';
import { import {
setSessionId, setSessionId,
@ -8,14 +8,12 @@ import {
} from '@/analytics/hooks/useEventTracker'; } from '@/analytics/hooks/useEventTracker';
import { useRequestFreshCaptchaToken } from '@/captcha/hooks/useRequestFreshCaptchaToken'; import { useRequestFreshCaptchaToken } from '@/captcha/hooks/useRequestFreshCaptchaToken';
import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState'; import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState';
import { isAppWaitingForFreshObjectMetadataState } from '@/object-metadata/states/isAppWaitingForFreshObjectMetadataState';
import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope'; import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
import { AppBasePath } from '@/types/AppBasePath'; import { AppBasePath } from '@/types/AppBasePath';
import { AppPath } from '@/types/AppPath'; import { AppPath } from '@/types/AppPath';
import { PageHotkeyScope } from '@/types/PageHotkeyScope'; import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { SettingsPath } from '@/types/SettingsPath'; import { SettingsPath } from '@/types/SettingsPath';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope'; import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { useDebouncedCallback } from 'use-debounce';
import { useCleanRecoilState } from '~/hooks/useCleanRecoilState'; import { useCleanRecoilState } from '~/hooks/useCleanRecoilState';
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation'; import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation'; import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation';
@ -52,27 +50,11 @@ export const PageChangeEffect = () => {
} }
}, [location, previousLocation]); }, [location, previousLocation]);
const setIsAppWaitingForFreshObjectMetadata = useSetRecoilState(
isAppWaitingForFreshObjectMetadataState,
);
const setIsAppWaitingForFreshObjectMetadataDebounced = useDebouncedCallback(
() => {
setIsAppWaitingForFreshObjectMetadata(false);
},
100,
);
useEffect(() => { useEffect(() => {
if (isDefined(pageChangeEffectNavigateLocation)) { if (isDefined(pageChangeEffectNavigateLocation)) {
navigate(pageChangeEffectNavigateLocation); navigate(pageChangeEffectNavigateLocation);
// setIsAppWaitingForFreshObjectMetadataDebounced();
} }
}, [ }, [navigate, pageChangeEffectNavigateLocation]);
navigate,
pageChangeEffectNavigateLocation,
setIsAppWaitingForFreshObjectMetadataDebounced,
]);
useEffect(() => { useEffect(() => {
switch (true) { switch (true) {

View File

@ -11,8 +11,6 @@ export const ObjectMetadataItemsGater = ({
isAppWaitingForFreshObjectMetadataState, isAppWaitingForFreshObjectMetadataState,
); );
console.log(isAppWaitingForFreshObjectMetadata);
const shouldDisplayChildren = !isAppWaitingForFreshObjectMetadata; const shouldDisplayChildren = !isAppWaitingForFreshObjectMetadata;
return ( return (

View File

@ -11,7 +11,6 @@ export const ObjectMetadataItemsProvider = ({
children, children,
}: React.PropsWithChildren) => { }: React.PropsWithChildren) => {
const objectMetadataItems = useRecoilValue(objectMetadataItemsState); const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
console.log('objectMetadataItems', objectMetadataItems);
const shouldDisplayChildren = objectMetadataItems.length > 0; const shouldDisplayChildren = objectMetadataItems.length > 0;