Skip to content

Adding a second hook does not refresh the Studio anymore #7398

@JonnyBurger

Description

@JonnyBurger

This is only anecdotal, but I think that let's say you have a component

const MyComp: React.FC = () => {
  return null;
}

and then you add a hook

const MyComp: React.FC = () => {
  const frame = useCurrentFrame();
  return null;
}

There is a React error: "Rendered more hooks than before".
This is expected – but we intend to reload the Studio.
Same for when the order has changed and when there are fewer hooks now.

It seems to not work anymore recently.

We should also check if this applies to files:

  • Where the component is not export ed
  • Where the <Composition> is in the same file

Because we know this affects fast refresh.

Ideally we have some E2E tests that cover this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions