Skip to content

The props of the Title component are read during cleanup #56

@AFatNiBBa

Description

@AFatNiBBa

Steps to reproduce

  1. Go to this playground
  2. Click "Hide"
  3. A warning will be logged in the console

Description

In the example, a memo is created by the compiler where getCountCheckOwner() gets read.
The problem is that the children prop is read here (On getTagKey() called by removeTag()) during the removal of the tag when disposing.
This is not ok because at that point in time there's no Owner, so the memo created by reading children will never be disposed

Maybe it is onCleanup() that should restore the Owner?
I don't know, but it wouldn't be enough to fix this situation anyway, since the cleanup would still be delayed (Potentially indefinitely)

Suggestion

I suggest changing that code as follows:

const tagProps = Object.fromEntries(
  properties
    .filter(k => k in tag.props)
    .map(k => [k, tag.props[k]])
    .sort()
);
const tagProps = Object.fromEntries(
+  properties
+    .filter(k => k in tag.props)
+    .map(k => [k, tag.props[k]])
-  Object.entries(tag.props)
-    .filter(([k]) => properties.includes(k))
    .sort()
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions