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

treat missing entries in context as nil entries #35

Merged
merged 1 commit into from Jul 30, 2019

Conversation

frenchy64
Copy link
Contributor

Problem

Adding new entries to the root of the context doesn't trigger rerenderings.
See cljfx.context-test.empty-context for a minimal example.
Notice "x1" is skipped after dissoc:
context-bug

Solution

Improve cache invalidation logic to recognize newly added keys. These two old-map/new-map cases now behave identically:

  {:foo nil} => {:foo 1}
  {}         => {:foo 1}

Final result: "x1" is shown after dissoc
context-bug-fixed

Problem: adding new entries to the root of the context
doesn't trigger rerenderings.
See `cljfx.context-test.empty-context` for a minimal
example.

Solution: improve cache invalidation logic to recognize
newly added keys. These two old-map/new-map cases now
behave identically:
  {:foo nil} => {:foo 1}
  {}         => {:foo 1}
@frenchy64
Copy link
Contributor Author

Forced push uses (distinct) transducers instead of intermediate (into #{}).

@vlaaad
Copy link
Contributor

vlaaad commented Jul 30, 2019

Great find! I wasn't expecting people to be actively exploring context stuff 😊 Many thanks!

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