mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
Fix: Move hooks to before we bail if the flag is off. (#9659)
This fixes the a react crash when we render more/fewer hooks than on the previous render if the flag state changes.
This commit is contained in:
parent
eae7535bfc
commit
89f63285a0
@ -49,17 +49,17 @@ export const FeatureOverview = () => {
|
|||||||
setLastViewed({ featureId, projectId });
|
setLastViewed({ featureId, projectId });
|
||||||
}, [featureId]);
|
}, [featureId]);
|
||||||
const flagOverviewRedesign = useUiFlag('flagOverviewRedesign');
|
const flagOverviewRedesign = useUiFlag('flagOverviewRedesign');
|
||||||
|
const { setSplashSeen } = useSplashApi();
|
||||||
|
const { splash } = useAuthSplash();
|
||||||
|
const [showTooltip, setShowTooltip] = useState(false);
|
||||||
|
const [hasClosedTooltip, setHasClosedTooltip] = useState(false);
|
||||||
|
|
||||||
if (!flagOverviewRedesign) {
|
if (!flagOverviewRedesign) {
|
||||||
return <LegacyFleatureOverview />;
|
return <LegacyFleatureOverview />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { setSplashSeen } = useSplashApi();
|
|
||||||
const { splash } = useAuthSplash();
|
|
||||||
const dragTooltipSplashId = 'strategy-drag-tooltip';
|
const dragTooltipSplashId = 'strategy-drag-tooltip';
|
||||||
const shouldShowStrategyDragTooltip = !splash?.[dragTooltipSplashId];
|
const shouldShowStrategyDragTooltip = !splash?.[dragTooltipSplashId];
|
||||||
const [showTooltip, setShowTooltip] = useState(false);
|
|
||||||
const [hasClosedTooltip, setHasClosedTooltip] = useState(false);
|
|
||||||
const toggleShowTooltip = (envIsOpen: boolean) => {
|
const toggleShowTooltip = (envIsOpen: boolean) => {
|
||||||
setShowTooltip(
|
setShowTooltip(
|
||||||
!hasClosedTooltip && shouldShowStrategyDragTooltip && envIsOpen,
|
!hasClosedTooltip && shouldShowStrategyDragTooltip && envIsOpen,
|
||||||
|
Loading…
Reference in New Issue
Block a user