fix(admin-panel): prevent layout shift when toggling feature flags (#12686)
Closes #12571 ~~## What’s broken?~~ ~~Toggling a feature flag in the admin panel re-renders the entire table and uses a Framer Motion slide animation for the knob. Each animation frame forces a layout recalculation all the way up, causing the page to “jump.”~~ ~~## What’s the fix?~~ ~~Swap out the Framer Motion toggle for a pure-CSS version:~~ ~~- Container is position: relative~~ ~~- Knob is position: absolute and moves via left~~ ~~- A transition: left 0.3s ease + will-change: left hint runs on the compositor layer~~ ~~This keeps the smooth slide effect but never triggers parent layout reflows.~~ ~~No changes to the public <Toggle> API or behavior.~~ ~~TODO: test all toggles in app and stories if any~~ --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -20,15 +20,8 @@ import { useLingui } from '@lingui/react/macro';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { useState } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
import {
|
||||
FeatureFlagKey,
|
||||
useImpersonateMutation,
|
||||
useUpdateWorkspaceFeatureFlagMutation,
|
||||
} from '~/generated/graphql';
|
||||
import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';
|
||||
import { AvatarChip } from 'twenty-ui/components';
|
||||
import { Button, Toggle } from 'twenty-ui/input';
|
||||
import {
|
||||
H2Title,
|
||||
IconEyeShare,
|
||||
@ -36,7 +29,14 @@ import {
|
||||
IconId,
|
||||
IconUser,
|
||||
} from 'twenty-ui/display';
|
||||
import { Button, Toggle } from 'twenty-ui/input';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
import {
|
||||
FeatureFlagKey,
|
||||
useImpersonateMutation,
|
||||
useUpdateWorkspaceFeatureFlagMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
type SettingsAdminWorkspaceContentProps = {
|
||||
activeWorkspace: WorkspaceInfo | undefined;
|
||||
|
||||
Reference in New Issue
Block a user