This repository was archived by the owner on Nov 6, 2026. It is now read-only.
Repository navigation
fix(dom): a reconcile that throws clears the element's state instead of freezing it (#82) - #84
Closed
markaddleman wants to merge 1 commit into
Closed
markaddleman wants to merge 1 commit into
markaddleman wants to merge 1 commit into
Conversation
…of freezing it When reconcile throws, clearing the latch alone is not enough because the patch stopped part way and the live DOM matches no vdom. Keeping :current makes the next render diff the live DOM against a tree that does not describe it, which is the same disagreement that threw. Dropping the whole entry from state allows the next render to find no entry, clearing innerHTML and painting from nil cleanly. Re-throwing the error ensures render failures are not silently masked so callers can react. Closes cjohansen#82.
Owner
|
I solved this in a similar fashion myself. As stated in the Readme, I don't take LLM contibutions. This PR has many LLM-isms, and your previous PR had Claude explicitly mentioned. The commits are also using a "conventional commit" template that is alien to this codebase, and that I have in fact actively decided not to use. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #82.
Problem
When
reconcilethrows insidereplicant.dom/render, clearing the latch alone is not enough because the patch stopped part way and the DOM matches no vdom. Keeping:currentmakes the next render diff the live DOM against a tree that does not describe it, which is the same disagreement that threw. Furthermore, swallowing the error intoconsole.errormasks the failure from the caller.Fix
In
replicant.dom/render:stateon throw via(vswap! state dissoc el). The next render finds no entry, clearsinnerHTML, and mounts cleanly fromnil.Verification
Ran test suites against
main:clojure -X:dev:test-> 24 tests, 300 assertions, 0 failures.clojure -M:test-cljs-> 19 tests, 259 assertions, 0 failures, 0 errors.