libp2p / observer-toolkit

🐣 [WIP] toolkit for building libp2p introspection widgets + a few useful out-of-the-box widgets
https://libp2p.io
MIT License
2 stars 2 forks source link

Refactor useDatastore so it's never unmounted #58

Closed AlanSl closed 4 years ago

AlanSl commented 4 years ago

This fixes some, but not all, of the "updated state in an unmounted component" issues on changing data sources. It should improve stability and make the data handling much cleaner and more maintainable.

The remaining issues are related to how the UI reloads after the data is loaded which will be done in a separate PR also improving the UX there.

ovhemert commented 4 years ago

Should this also resolve the unmount-error when reloading the files?

That part still gives me the following:

index.js:1406 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in DataPanel (at ControlPanel.js:38)
    in div (created by Context.Consumer)
    in StyledComponent (created by ControlPanel__DataPanelSection)
    in ControlPanel__DataPanelSection (at ControlPanel.js:37)
    in div (created by Context.Consumer)
    ...

Reproduce:

AlanSl commented 4 years ago

That needs the follow-up work in the other PR that I mentioned in the PR description

On Fri, 10 Apr 2020, 15:19 Osmond van Hemert, notifications@github.com wrote:

Should this also resolve the unmount-error when reloading the files?

That part still gives me the following:

index.js:1406 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function. in DataPanel (at ControlPanel.js:38) in div (created by Context.Consumer) in StyledComponent (created by ControlPanelDataPanelSection) in ControlPanelDataPanelSection (at ControlPanel.js:37) in div (created by Context.Consumer) ...

Reproduce:

  • load sample file 1
  • change data source
  • load sample file 1 again
  • error message is in the console

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nearform/libp2p-introspection-ui/pull/58#issuecomment-612049129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHCBPI4PVAZR7LUAYRX7UATRL4THDANCNFSM4MFPE66Q .

ovhemert commented 4 years ago

Ah ok... thought that was again another thing... This part fine by me 👍🏻