Fix API key not displayed (#9766)

Fixes #9761

Instead of cleaning RecoilState we should keep the api key visible as
long as the user didn't refresh/leave the app, it's better from a UX
perspective and the code is also more elegant, removing a useEffect


Note: the root cause of the bug was a missing "/settings" path in
isMatchingLocation in useCleaningRecoilState (due to the recent
refactoring) ; but I think this fix is better
This commit is contained in:
Félix Malfait
2025-01-21 14:18:22 +01:00
committed by GitHub
parent 8e0467e2e4
commit 86b0a7952b
25 changed files with 363 additions and 377 deletions

View File

@ -21,7 +21,6 @@ import { AppPath } from '@/types/AppPath';
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { SettingsPath } from '@/types/SettingsPath';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { useCleanRecoilState } from '~/hooks/useCleanRecoilState';
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation';
import { isDefined } from '~/utils/isDefined';
@ -41,8 +40,6 @@ export const PageChangeEffect = () => {
const pageChangeEffectNavigateLocation =
usePageChangeEffectNavigateLocation();
const { cleanRecoilState } = useCleanRecoilState();
const eventTracker = useEventTracker();
//TODO: refactor useResetTableRowSelection hook to not throw when the argument `recordTableId` is an empty string
@ -52,10 +49,6 @@ export const PageChangeEffect = () => {
const resetTableSelections = useResetTableRowSelection(objectNamePlural);
useEffect(() => {
cleanRecoilState();
}, [cleanRecoilState]);
useEffect(() => {
if (!previousLocation || previousLocation !== location.pathname) {
setPreviousLocation(location.pathname);