Skip to content

Commit

Permalink
fix(FeatureFlags): remove forced rerender, causing focus issues (carb…
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgallo authored Jun 6, 2024
1 parent 3b244e6 commit 596cbc0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/core/.storybook/WithFeatureFlags/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { Annotation } from '../Annotation';

export const WithFeatureFlags = ({ flags, children }) => {
const [updatedFlags, setUpdatedFlags] = useState();
const [tempKey, setTempKey] = useState(0);
const allFlagsEnabled = Object.fromEntries(
Array.from(FeatureFlagScope.flags.keys()).map((k) => [k, true])
);
Expand All @@ -28,12 +27,11 @@ export const WithFeatureFlags = ({ flags, children }) => {
FeatureFlagScope.flags.set(key, value);
}
setUpdatedFlags(FeatureFlagScope.flags);
setTempKey((prev) => prev + 1);
}
}, [flags]);

return (
<FeatureFlags flags={flags ? updatedFlags : allFlagsEnabled} key={tempKey}>
<FeatureFlags flags={flags ? updatedFlags : allFlagsEnabled}>
<Annotation
type="feature-flags"
text={
Expand Down

0 comments on commit 596cbc0

Please sign in to comment.