Render the trace diagrams in misconception explainers - #177
Merged
Conversation
The "recommended review" card on the home page embeds a misconception explainer fragment, and two of the eight (implicitf, exclusiveu) build their argument around trace diagrams. index.html was the only page emitting .trace-diagram markup without loading tracerenderer.js, so those diagrams stayed empty divs: the Finally explainer ended on "Thus both these traces satisfy F p:" followed by nothing. It read as intermittent because the card picks one explainer at random from the student's top two misconceptions, and most explainers have no traces to lose. Load the renderer on the home page and run a render pass there. The three copies of that pass (home page, exercise questions, answer feedback) collapse into one TraceRenderer.renderAll(root), so the next page to emit trace markup only has to call it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was wrong
The "recommended review" card on the home page embeds a misconception explainer fragment, and two of the eight (
implicitf,exclusiveu) build their argument around trace diagrams.index.htmlwas the one page emitting.trace-diagrammarkup without loadingtracerenderer.js, so those diagrams stayed empty<div>s.The Finally explainer ended on "Thus both these traces satisfy
F p:" followed by nothing; the Until explainer's closing sentence ("This shows thatxcan still hold true whenyis satisfied…") referred to a trace that wasn't there.It read as intermittent because the card picks one explainer at random from the student's top two misconceptions, and most explainers have no traces to lose.
exercise.htmlandstepper.htmlalready loaded the renderer and ran their own render pass, which is why traces worked everywhere else.The fix
tracerenderer.json the home page and run a render pass onDOMContentLoaded.TraceRenderer.renderAll(root)helper, so the next page that emits trace markup only has to call it. Same semantics as before: descendants only, skip anything already carryingdata-rendered, per-diagramtry/catch.renderAlldeliberately has no visibility filter —exercise.htmlhides all but the current question and renders each one as it is shown, so diagram widths are measured against a laid-out container. That behavior is unchanged.Verification
Ran the app locally and checked all three paths in a browser:
index.htmlwith each trace-bearing explainer forced into the review card. Both now draw: the Finally explainer's two traces (!p; cycle{p}and!p; !p; cycle{!p; p}) and the Until explainer's single trace. No console errors.331 passedon the Python suite.Notes
Version bumped to 2.1.6 with a CHANGELOG entry.