Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Can't perform a React state update on an unmounted component when SCRIPT_DEBUG true #19642

Closed
bobbingwide opened this issue Jan 14, 2020 · 3 comments
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@bobbingwide
Copy link
Contributor

bobbingwide commented Jan 14, 2020

Describe the bug
When SCRIPT_DEBUG is defined as true then the following message is written to the console log when performing trivial actions such as Duplicate block or Remove block.

backend.js:6 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 the componentWillUnmount method.

The stack trace seems to vary.

    in SlotComponent (created by Context.Consumer)
    in Slot (created by __experimentalBlockSettingsMenuPluginsExtensionSlot)
    in __experimentalBlockSettingsMenuPluginsExtensionSlot (created by Dropdown)
    in div (created by MenuGroup)
    in div (created by MenuGroup)
    in MenuGroup (created by WithInstanceId(MenuGroup))
    in WithInstanceId(MenuGroup) (created by Dropdown)
    in div (created by NavigableContainer)
    in NavigableContainer (created by ForwardRef(NavigableContainer))
    in ForwardRef(NavigableContainer) (created by ForwardRef(NavigableMenu))
    in ForwardRef(NavigableMenu) (created by Dropdown)
    in div (created by Animate)
    in div (created by IsolatedEventContainer)
    in IsolatedEventContainer (created by Animate)
    in Animate (created by Popover)
    in PopoverDetectOutside (created by WithFocusOutside(PopoverDetectOutside))
    in div (created by WithFocusOutside(PopoverDetectOutside))
    in WithFocusOutside(PopoverDetectOutside) (created by Popover)
    in Unknown (created by FocusReturn)
    in div (created by FocusReturn)
    in FocusReturn (created by Context.Consumer)
    in WithFocusReturn(Component) (created by WithConstrainedTabbing(WithFocusReturn(Component)))
    in div (created by WithConstrainedTabbing(WithFocusReturn(Component)))
    in WithConstrainedTabbing(WithFocusReturn(Component)) (created by Popover)
    in fill_FillComponent (created by Context.Consumer)
    in Fill (created by Context.Consumer)
    in span (created by Context.Consumer)
    in Popover (created by Dropdown)
    in div (created by Dropdown)
    in Dropdown (created by DropdownMenu)
    in DropdownMenu (created by BlockActions)
    in div (created by ToolbarContainer)
    in ToolbarContainer (created by Toolbar)
    in Toolbar (created by BlockActions)
    in BlockActions (created by WithDispatch(BlockActions))
    in WithDispatch(BlockActions)
    in Unknown (created by WithSelect(WithDispatch(BlockActions)))
    in WithSelect(WithDispatch(BlockActions)) (created by BlockSettingsMenu)
    in BlockSettingsMenu (created by BlockToolbar)
    in div (created by BlockToolbar)
    in BlockToolbar
    in Unknown (created by WithSelect(BlockToolbar))
    in WithSelect(BlockToolbar) (created by BlockContextualToolbar)
    in div (created by NavigableContainer)
    in NavigableContainer (created by ForwardRef(NavigableContainer))
    in ForwardRef(NavigableContainer) (created by ForwardRef(NavigableMenu))
    in ForwardRef(NavigableMenu) (created by NavigableToolbar)
    in NavigableToolbar (created by BlockContextualToolbar)
    in BlockContextualToolbar (created by block_BlockListBlock)

To reproduce
Steps to reproduce the behavior:

  1. define( 'SCRIPT_DEBUG', true ); in wp-config.php
  2. Add new post.
  3. Inspect
  4. Create a paragraph
  5. Choose More options > Duplicate.
  6. See the Warning in the Console log.

Expected behavior
Either some documentation explaining which messages are expected and why.
Or no message for this action.

Screenshots
This is a screenshot when Gutenberg 7.2.0 is activated. In this post I deleted a paragraph.
image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] current

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Initially mentioned in #18977 and on Slack https://wordpress.slack.com/archives/C02QB2JS7/p1578996401066300

  • It happens with WordPresss core 5.3.2 and default theme Twenty Twenty.
  • Not resolved with Gutenberg 7.2.0 (built version).
@seanvarnham
Copy link

Has there been a resolution to this @bobbingwide ? I have the exact same issue when building a Gutenberg plugin on Mac OS using Chrome version 79.0.3945.130 (Official Build) (64-bit)

@bobbingwide
Copy link
Contributor Author

Has there been a resolution to this

It hasn't even been triaged @blt-sean. Workaround is to set SCRIPT_DEBUG false.

@talldan talldan added Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Feb 5, 2020
@talldan
Copy link
Contributor

talldan commented Feb 5, 2020

Was able to reproduce this. It shouldn't cause any issues in usage, but yep, we'd want to fix a potential memory leak.

It looks like this is actually a duplicate of #17355 which is tracking these issues, so I'll close in favour of that.

@talldan talldan closed this as completed Feb 5, 2020
@talldan talldan added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed and removed [Type] Bug An existing feature does not function as intended labels Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

3 participants