Skip to content

[compiler] Allow functions containing refs to be returned - #30724

Merged
mvitousek merged 3 commits into
gh/mvitousek/30/basefrom
gh/mvitousek/30/head
Aug 16, 2024
Merged

mvitousek merged 3 commits into
gh/mvitousek/30/basefrom
gh/mvitousek/30/head

Conversation

@mvitousek

@mvitousek mvitousek commented Aug 16, 2024 •

Copy link
Copy Markdown
Contributor

Summary:
We previously were excessively strict about preventing functions that access refs from being returned--doing so is potentially valid for hooks, because the return value may only be used in an event or effect.

[ghstack-poisoned]
@vercel

vercel Bot commented Aug 16, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 16, 2024 5:16pm

Summary:
We previously were excessively strict about preventing functions that access refs from being returned--doing so is potentially valid for hooks, because the return value may only be used in an event or effect.

[ghstack-poisoned]

@josephsavona josephsavona left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks for following up on this. see fixture before landing though


```

### Eval output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

Summary:
We previously were excessively strict about preventing functions that access refs from being returned--doing so is potentially valid for hooks, because the return value may only be used in an event or effect.

[ghstack-poisoned]
@mvitousek
mvitousek merged commit ff1a1a3 into gh/mvitousek/30/base Aug 16, 2024
mvitousek added a commit that referenced this pull request Aug 16, 2024
Summary:
We previously were excessively strict about preventing functions that access refs from being returned--doing so is potentially valid for hooks, because the return value may only be used in an event or effect.

ghstack-source-id: cfa8bb1
Pull Request resolved: #30724
@mvitousek
mvitousek deleted the gh/mvitousek/30/head branch August 16, 2024 17:28
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
Summary:
We previously were excessively strict about preventing functions that access refs from being returned--doing so is potentially valid for hooks, because the return value may only be used in an event or effect.

ghstack-source-id: cfa8bb1
Pull Request resolved: react#30724

This branch was successfully deployed

1 active deployment
Preview — ff1a1a3d Deployed Aug 16, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants