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 test for using use_memo with use_effect #2415

Conversation

pablosichert
Copy link

@pablosichert pablosichert commented May 15, 2024

This PR is a reproduction test case for #2416.

Currently, when starting with (0, 0) and writing

Write(Some(0), None)
Write(None, Some(0))
Write(Some(0), Some(0))
Write(Some(1), None)
Write(None, Some(1))
Write(Some(1), Some(1))
Write(Some(2), Some(2))
Write(Some(0), Some(0))

this test results in the following reads:

Read(0, 0)
Read(1, 1)
Read(1, 1)
Read(0, 0)
Read(0, 0)

However, the expected result is

Read(0, 0)
Read(1, 0)
Read(1, 1)
Read(2, 2)
Read(0, 0)

.unwrap();
});

None
Copy link
Author

Choose a reason for hiding this comment

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

Ok, interesting, if you change this line to:

Suggested change
None
rsx! {"{tuple:?}"}

The test passes.

@ealmloff
Copy link
Member

The issue with memos over subscribing is fixed in #2506, but this test will still fail because it assumes that effects rerun once every time a dependency updates. They may drop updates freely as long as the latest value is consistent (in this test (0, 0)). I added a test to #2506 that tests for regressions in synchronous updates with memo

@ealmloff ealmloff closed this Jun 11, 2024
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.

None yet

2 participants