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

Add some more details about batch #592

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mosheduminer
Copy link
Contributor

@mosheduminer mosheduminer commented Mar 17, 2024

This PR is the follow up from a conversation in the discord, where someone tested the behavior of createEffect and found it wasn't batched. This PR addresses the confusion by documenting when createEffect is automatically batched, and when it isn't. It also adds another piece of information I felt was missing from the batch docs, namely the expected behavior when setting and then accessing a signal within a batch. This behavior used to be different pre-v1.4 which makes it additionally useful as a documentation of a breaking change.

In summary, this PR clarifies:

  • createEffect is not batched outside root / at top level
  • the expected behavior when eagerly accessing signals set within the same batch (prior to v1.4 this returned the old value, this is not longer the case)

Copy link

stackblitz bot commented Mar 17, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Mar 17, 2024

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit de39208
🔍 Latest deploy log https://app.netlify.com/sites/solid-docs/deploys/6637a4d57c1863000848e5f3
😎 Deploy Preview https://deploy-preview-592--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@titoBouzout
Copy link
Collaborator

Please hold this PR we are still trying to clarify some points that may or may not lead to some small change.

@LadyBluenotes
Copy link
Member

If it's not ready for review, please put it as a draft!

@atilafassina
Copy link
Member

Please hold this PR we are still trying to clarify some points that may or may not lead to some small change.

hey @titoBouzout , I lost track of this convo. What came out of it?

…gnals in batch, and reference to batch from create-effect
@titoBouzout
Copy link
Collaborator

hey @titoBouzout , I lost track of this convo. What came out of it?

Top level effects aren't batched, regular effects are batched. The idea was to batch them all to make them consistent. While the change is welcome solidjs/solid#2107 this probably will take effect on solid 2.0 to avoid unnecessary behavior changes, which sounds like a sensible option and this pr could probably be reviewed I guess

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.

4 participants