Skip to content

Commit

Permalink
fix: warning on unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-0x447f committed Oct 25, 2019
1 parent 53783cd commit ec3bce8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/jss/renderInShadowRoot.tsx
@@ -1,11 +1,11 @@
import { create } from 'jss'
import { jssPreset, createGenerateClassName, StylesProvider, ThemeProvider } from '@material-ui/styles'
import { createGenerateClassName, jssPreset, StylesProvider, ThemeProvider } from '@material-ui/styles'
import ReactDOM from 'react-dom'
import React from 'react'
import { MaskbookLightTheme, MaskbookDarkTheme } from '../theme'
import { MaskbookDarkTheme, MaskbookLightTheme } from '../theme'
import ConstructableStyleSheetsRenderer, {
livingShadowRoots,
applyAdoptedStyleSheets,
livingShadowRoots,
} from './ConstructableStyleSheetsRenderer'

const jss = create({ ...jssPreset(), Renderer: ConstructableStyleSheetsRenderer as any })
Expand All @@ -20,6 +20,7 @@ export function renderInShadowRoot(node: React.ReactNode, shadow: ShadowRoot) {
livingShadowRoots.add(shadow)
applyAdoptedStyleSheets()
return () => {
shadow.adoptedStyleSheets = []
ReactDOM.unmountComponentAtNode(shadow as any)
livingShadowRoots.delete(shadow)
}
Expand Down

0 comments on commit ec3bce8

Please sign in to comment.