Diagnostics

OPTIMISTIC_WRITE_WHILE_LOADING

Optimistic write to a source that answered before and is loading a new question; the new answer replaces the guess (once per source).


What you saw

  • Kind: write
  • Severity: warn (code that works but is structurally wrong or expensive)

The console report opens with [OPTIMISTIC_WRITE_WHILE_LOADING] and the message, then an in line naming the owners that enclose the subject, root first, and an at line with the source location when the code was compiled with one. In a captured artifact the same finding is an event with code: "OPTIMISTIC_WRITE_WHILE_LOADING", ownerPath, and loc. Diagnostics explains each line.


Why it fires

An optimistic setter ran while its source, which answered before, is loading a new question because an input changed: the setter composed on the previous answer, and the new answer replaces the guess (D-34, ruled 2026-11-12). A Loading on re-arm shows a fallback, but the source still holds the old answer. Not flagged before the first answer or during a refresh().


How to fix it

Repair: render the control inside the source's Loading, or disable it while the source is pending, or keep the pending change in a separate list until the new answer lands. Once per source; a warning, the guess is still made.


In tests

captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw. expectNoDiagnostics(artifact) fails while OPTIMISTIC_WRITE_WHILE_LOADING is among them, with the events as evidence; after the fix, the code is gone from artifact.diagnostics. Check for regressions in tests shows the loop and the Vitest matcher form.


Learn more

Last updated: 11/16/26, 6:55 AMEdit this pageReport an issue with this page