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

Clarification on o/reset! usage. #15

Open
drewverlee opened this issue Jun 2, 2022 · 1 comment
Open

Clarification on o/reset! usage. #15

drewverlee opened this issue Jun 2, 2022 · 1 comment

Comments

@drewverlee
Copy link

The docs seem to suggest you can use reset! outside the rules block.

The session dynamic var will have the current value of the session, and reset! will update it so it has the newly-inserted value. This is nice if you want to thread a lot of calls together, or if you want to write code that works the same both inside and outside of the rule.

Which seems to disagree with the helpful exception:

You may only call `reset!` in a :then or :then-finally block

Can you give an example of something that runs inside and outside the rule code block.

@oakes
Copy link
Owner

oakes commented Jun 2, 2022

It can only be called inside of a rule. What i meant is that the threaded insert calls you make can run outside of a rule too, so you could put them in a function and run them in either place. If you use insert! instead, those calls will not work outside of a rule.

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

No branches or pull requests

2 participants