Skip to content

Commit

Permalink
PLAT-110785: Fix useFloatingLayer to defer update until mounted (#2792)
Browse files Browse the repository at this point in the history
Enact-DCO-1.0-Signed-off-by: Roy Sutton [email protected]

Reviewed-By: Jeremy Thomas ([email protected])
Integrated-By: Ryan Duffy ([email protected])
  • Loading branch information
Roy Sutton authored Jun 16, 2020
1 parent 8d948d7 commit 68f8d2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/ui/FloatingLayer/useFloatingLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ function useFloatingLayer () {
}, [setId]);

const registerFloatingLayer = React.useContext(FloatingLayerContext);
if (registerFloatingLayer) {
registerFloatingLayer(handler);
}

React.useEffect(() => {
if (registerFloatingLayer) {
registerFloatingLayer(handler);
}
}, [handler, registerFloatingLayer]);

return {floatingLayerId};
}
Expand Down

0 comments on commit 68f8d2e

Please sign in to comment.