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

Lazy state fails on function calls #684

Open
josephjclark opened this issue May 9, 2024 · 1 comment
Open

Lazy state fails on function calls #684

josephjclark opened this issue May 9, 2024 · 1 comment

Comments

@josephjclark
Copy link
Collaborator

This should work:

fn((state) => {
   state.callMeMaybe = () => {}
  return state
});

fn($.callMeMaybe())
fn((state) => {
   $.callMeMaybe()
)

But it does not - $ is undefined.

This is likely just a compiler issue. I think we should allow the usecase

@josephjclark
Copy link
Collaborator Author

Although to be fair I prefer this pattern anyway:

const callMeMaybe = () => {}

fn(callMeMaybe())
fn((state) => {
   callMeMaybe()
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Icebox
Development

No branches or pull requests

1 participant