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

Closed
wants to merge 1 commit into from

Conversation

mosheduminer
Copy link
Collaborator

@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!

@mosheduminer mosheduminer marked this pull request as draft March 18, 2024 23:45
@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

@brenelz
Copy link
Collaborator

brenelz commented Dec 16, 2024

Is this PR still valid?

@mosheduminer
Copy link
Collaborator Author

Looks like I dropped the ball on this one, I'll add the distinction between top level and component level and reopen it.

@edemaine
Copy link
Contributor

Note that some of this is getting addressed in #982, so perhaps best to wait for that to land first.

@mosheduminer
Copy link
Collaborator Author

@edemaine sure.

edemaine added a commit that referenced this pull request Dec 17, 2024
@edemaine
Copy link
Contributor

@mosheduminer I ended up having to fix some bugs in #982, so while I was at it, I tried to incorporate your changes into that PR (with commit coauthor credit). Do you want to take a look (last two commits) and confirm that it looks good to you? If so, I think we can merge that PR and close this PR.

@mosheduminer
Copy link
Collaborator Author

@edemaine thanks! Looks good, except the behavior (introduced in 1.4) of returning the non-stale value is true for both signals and memos (both used), but your edit only mentions memos. I think it might be worthwhile to document the behavior as introduced for signals well, mainly so people looking can see that prior to 1.4 the behavior of signals was different.

@edemaine
Copy link
Contributor

Good idea! Done.

@edemaine edemaine closed this Dec 17, 2024
@edemaine edemaine mentioned this pull request Dec 17, 2024
2 tasks
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.

6 participants