Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd3a971

Browse files
authoredAug 30, 2023
fix: hydration error from state update in FlagProvider (#124) (#125)
1 parent 4c202bc commit fd3a971

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/FlagProvider.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@ const FlagProvider: React.FC<React.PropsWithChildren<IFlagProvider>> = ({
4848
}
4949

5050
const errorCallback = (e: any) => {
51-
setFlagsError(currentError => currentError || e);
51+
React.startTransition(() => {
52+
setFlagsError(currentError => currentError || e);
53+
});
5254
};
5355

5456
let timeout: any;
5557
const readyCallback = () => {
5658
// wait for flags to resolve after useFlag gets the same event
5759
timeout = setTimeout(() => {
58-
setFlagsReady(true);
60+
React.startTransition(() => {
61+
setFlagsReady(true);
62+
});
5963
}, 0);
6064
};
6165

0 commit comments

Comments
 (0)
Failed to load comments.