Skip to content

treat missing entries in context as nil entries - #35

Merged
vlaaad merged 1 commit into
cljfx:masterfrom
frenchy64:context-missing-entry
Jul 30, 2019
Merged

vlaaad merged 1 commit into
cljfx:masterfrom
frenchy64:context-missing-entry

Conversation

@frenchy64

Copy link
Copy Markdown
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
frenchy64 force-pushed the context-missing-entry branch from fcc28db to 0d57bcd Compare July 25, 2019 22:41
@frenchy64

Copy link
Copy Markdown
Contributor Author

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

@vlaaad

vlaaad commented Jul 30, 2019

Copy link
Copy Markdown
Contributor

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.

2 participants