Skip to content

avoid webpack hot reload problem with reach-ui Popover component

Administrator requested to merge fix-hot-reload-reach-ui-menu into master

Created by: sqs

The reach-ui Popover component uses React portals in a way that breaks Webpack hot reloading. This results in the following error after changing a file (necessitating a browser hard reload, which slows down the dev cycle):

(ActivationDropdown, in Portal (created by Popover)) TypeError: Cannot read property 'ownerDocument' of null

Stack trace:
at eval (webpack-internal:///1570:42:43)
in Portal (created by Popover)
in Popover (created by MenuPopover)
in MenuPopover (created by Menu)
in DescendantProvider (created by Menu)
in Menu (created by ActivationDropdown)
in ActivationDropdown (created by NavLinks)
in li (created by NavLinks)
in ul (created by NavLinks)
in NavLinks (created by GlobalNavbar)
in div (created by GlobalNavbar)
in GlobalNavbar (created by Layout)
in div (created by Layout)
in Layout (created by WithActivation)
in WithActivation (created by Context.Consumer)
in Route (created by ColdSourcegraphWebApp)
in Router (created by BrowserRouter)
in BrowserRouter (created by ColdSourcegraphWebApp)
in ShortcutProvider (created by ColdSourcegraphWebApp)
in ErrorBoundary (created by ColdSourcegraphWebApp)
in ColdSourcegraphWebApp (created by HotExportedColdSourcegraphWebApp)
in AppContainer (created by HotExportedColdSourcegraphWebApp)
in HotExportedColdSourcegraphWebApp

This commit does not fix it, but it does make it occur much less often: only when the activation menu button is shown.

Merge request reports

Loading