Skip to content

Commit

Permalink
Fix removeChild failure similar to atlassian#1751
Browse files Browse the repository at this point in the history
  • Loading branch information
ulion committed Jul 26, 2021
1 parent 799d215 commit 5444925
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/view/use-style-marshal/use-style-marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export default function useStyleMarshal(contextId: ContextId, nonce?: string) {
const remove = (ref) => {
const current: ?HTMLStyleElement = ref.current;
invariant(current, 'Cannot unmount ref as it is not set');
getHead().removeChild(current);
if (getHead().contains(current)) {
getHead().removeChild(current);
}
ref.current = null;
};

Expand Down

0 comments on commit 5444925

Please sign in to comment.