Skip to content

Accessing a Signal value from a preact PureComponent should error in development mode #930

Description

@DanielHeath

Describe the feature you'd love to see

If you access a signal from a PureComponent, it does not re-render when the signal value changes.

That makes sense to me - the component claims to be a pure function of its state/props - but it's easy to accidentally introduce a signal dependency to a pure component without changing its definition to impure, and the result looks like a bug in signals.

Would it be worth logging an error (at least in development mode) in this case?

Alternatively, should pure components also be able to subscribe to signal updates?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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