Skip to content

For component doesn't rerender children when parent values change #853

@vpzomtrrfrt

Description

@vpzomtrrfrt
  • Check if updating to the latest version resolves the issue

Environment

  • I am using @preact/signals-core
  • I am using @preact/signals
  • I am using @preact/signals-react

Describe the bug
<For> only renders once for each value in the list, which causes issues when its children reference non-signal values from the parent scope

To Reproduce
Please provide a link to a StackBlitz/CodeSandbox/Codepen project or a GitHub repository that demonstrates the issue.

Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/p/sandbox/vz46dt
  2. Click "Add Item". A random number should appear in the list.
  3. Check "Show Details". Nothing happens.
  4. Click "Add Item" again. The new number shows a timestamp.

Expected behavior
I expect checking the "Show Details" box to update the existing list items to show timestamps. Or if this is intentional behaviour, it should at least be mentioned in the documentation

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