Report mixed DoenetML versions to the containing page - #43
Merged
Conversation
23 tasks
Implements Doenet#39. Each document carries its own DoenetML `version`, and every embedded viewer downloads and parses the multi-MB standalone bundle for its document's version — an assignment mixing versions multiplies that cost by the number of distinct versions. The viewer does not normalize versions itself (that would change how older documents behave), and a console warning alone is invisible to the site's visitors, so the condition is reported to the containing page through a new `reportWarningsCallback` prop (typed `ActivityViewerWarning[]`, fired once per source analysis); the page decides how to display it. A console.warn is still emitted for developers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The report effect keyed on the `warnings` memo's array identity, which is rebuilt whenever a consumer passes a fresh (new-but-equal) `source` object each render — the pattern `propSetKey` already tolerates. That re-fired the `console.warn` and `reportWarningsCallback` on every render, breaking the "once per source analysis" contract. Dedupe on the serialized warning content via a ref so each distinct condition is reported at most once. Add a vitest case for an empty container (no versions) and a cypress case asserting the callback still fires exactly once when the host re-renders with a fresh source object each render. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Align the public prop JSDoc with the actual behavior: dedup is on the serialized warning content, so the callback fires once per distinct set of warnings — not "once per source analysis" (equal-warning sources do not re-fire). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dqnykamp
force-pushed
the
mixed-version-warning
branch
from
July 13, 2026 03:55
9a088f8 to
eab70fc
Compare
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.
Implements #39.
Each document in an assignment carries its own DoenetML
version, and every embedded viewer downloads and parses the multi-MB standalone bundle for its document's version — an assignment mixing versions multiplies that cost by the number of distinct versions on the page.Two deliberate non-choices, per discussion on the issue:
versionin the source; saved student state survives, as its hash deliberately ignoresversion).Reported once per distinct source analysis — not per render, not on callback-identity churn, and not repeatedly even when the host passes a fresh (new-but-equal)
sourceobject each render (deduped on the serialized warning content, the same sameness patternpropSetKeyalready relies on). Aconsole.warnis still emitted for developers, and the README documents the cost and the normalization path.Tests: vitest for the version collector (single doc / uniform collapse / mixed nested select in first-appearance order / empty container yields none); cypress component tests asserting the callback fires exactly once with the version list for a mixed assignment, still only once when the host re-renders with a fresh
sourceobject each render, and stays silent for a uniform one.🤖 Generated with Claude Code