Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: tidy up each block compiler logic #12513

Merged
merged 3 commits into from
Jul 21, 2024
Merged

chore: tidy up each block compiler logic #12513

merged 3 commits into from
Jul 21, 2024

Conversation

Rich-Harris
Copy link
Member

per #12511, I intend to look into whether we can use compile-time analysis to determine the behaviour of each blocks. Just doing a little tidy-up before I get started:

  • as far as I can see, node.context being a destructured pattern has no bearing on whether the index should be reactive
  • the reactivity or otherwise of the index should likewise have no bearing on whether we can use the fast path optimisation
  • removed an unused variable
  • renamed each_type to flags, to make it clearer that it's the same bitmask technique used elsewhere (as opposed to e.g. just keyed or indexed, as suggested by 'type')

Copy link

changeset-bot bot commented Jul 20, 2024

⚠️ No Changeset found

Latest commit: 31af7b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@trueadm
Copy link
Contributor

trueadm commented Jul 20, 2024

as far as I can see, node.context being a destructured pattern has no bearing on whether the index should be reactive

This worries me a bit. I feel like we've either somehow worked around this issue, or it still exists in some permutation. It would be good for one of us to play around a bit with destructuring and referencing indexes from that in each blocks to see if this might break something.

@Rich-Harris
Copy link
Member Author

Do you have any recollection of what problem it was solving? I can't imagine we'd have added that logic if there wasn't a test that failed without it, and I can't think of any reason it would be necessary

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

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

I think we need some more snapshot tests around each blocks, especially around key blocks that reference things like index. However, we can maybe do that after merging this.

@Rich-Harris Rich-Harris merged commit a01f658 into main Jul 21, 2024
9 checks passed
@Rich-Harris Rich-Harris deleted the tidy-up branch July 21, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants