Skip to content

[BHP1-1680] Fix No Results on Re-runs with Changing Outputs - #317

Open
Kcheung42 wants to merge 2 commits into
mainfrom
kc-BHP1-1680-fix-outputs-not-enabling-on-re-run
Open

Kcheung42 wants to merge 2 commits into
mainfrom
kc-BHP1-1680-fix-outputs-not-enabling-on-re-run

Conversation

@Kcheung42

Copy link
Copy Markdown
Collaborator

Purpose

Problem

Run a worksheet, go back to Outputs, tick another output, re-run — the new output has
no value in the results (-) and no row in Table Shading Filters.

Cause

  • solve-worksheet read its output set from @(rf/subscribe [:worksheet/all-output-uuids …]).
    That cached reaction doesn't re-run between the click and the solve: ticking an output
    writes only to the DataScript conn, never to app-db.

Changes

  • Add behave.solver.queries/enabled-output-uuids, a direct read of the conn.
  • solve-worksheet (core.cljs:242) and store-all-diagrams! (diagrams.cljs:78) use it
    instead of subscribing.
  • Revert :worksheet/enabled-output-uuids from BHP1-1660. Re-posh caused the issue with the solver not seeing the new output.
  • Keep the continuous-fmt guard so a non-numeric cell renders - instead of printing the
    string NaN, plus the matching nil checks in the result matrices. Backstop only.

Related Issues

Closes BHP1-1680

Submission Checklist

  • Included Jira issue in the PR title (e.g. BHP1-### <title>)
  • Code passes linter rules (clj-kondo --lint components/**/src bases/**/src projects/**/src)
  • Feature(s) work when compiled (clojure -M:compile-cljs)

Testing

  1. Open a surface worksheet
  2. Select:
  • Heading
  • Fire Perimeter
  1. Complete worksheet
  2. Navigate back to Outputs
  3. Select Rate of Spread (or any other output)
  4. Re-run Worksheet and ensure the new output is in the table shading filters (if applicable) and in the results.

Screenshots

Kcheung42 and others added 2 commits October 9, 2026 16:47
… subs

Enable an output on a worksheet that has already been run, re-run it, and the
output has no value in the results and no row in the table shading filters.

`solve-worksheet` took its output set from
`@(rf/subscribe [:worksheet/all-output-uuids ws-uuid])`, and that cached
reaction does not re-run between the user's click and the solve. Ticking an
output writes only to the DataScript conn, never to `app-db`. Reloading the page
before re-running avoided it, because that rebuilds every subscription.

The output still appeared in the solver log, which hid this for a long time.
`run-module` appends every output-source-link to the set it computes:

    module-outputs (-> all-outputs
                       (filter-module-outputs gv-uuids)
                       (add-source-link-outputs output-source-links))

Surface length_to_width_ratio is the source of a link into Contain's
length_to_width_ratio input, so it was computed and logged with a real value,
then dropped again by `remove-source-link-outputs`, which removes exactly those
source-link outputs that are not in `all-outputs`. No header, no cell, so
nothing for `update-all-table-filters-from-results` to seed min/max from, and
`:worksheet/table-settings-filters` needs both bounds before a filter row shows.

So `behave.solver.queries/enabled-output-uuids` reads the conn directly, and
`solve-worksheet` and `store-all-diagrams!` use it. A solve wants the database
as it stands this instant; it runs in the same breath as the writes from
`:wizard/before-solve`.

This also reverts the `:worksheet/enabled-output-uuids` re-posh sub and the
rewiring of `:worksheet/output-uuids-conditionally-filtered`,
`:worksheet/output-uuids-filtered`,
`:worksheet/directional-parent-output-uuids`,
`:worksheet/graphed-output-uuids` and `:worksheet/all-output-uuids` onto it.
Reverting proves it was not the cause: the same failure reproduces on
kc-BHP1-1663-fix-diagram-summary-outputs, where the sub reads the conn
directly, because the fault was the cached reaction in front of the solve
rather than what the sub's body read. Those five subs are back to their
b08a079 form.

Kept: the `continuous-fmt` guard, so a non-numeric cell renders the "-"
placeholder instead of printing the string "NaN", and the matching nil checks in
the result matrices. That is a backstop against a bad cell, independent of this
cause.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rjsheperd

Copy link
Copy Markdown
Contributor

After working through the testing script (1st try with Heading + RoS,
then adding Fire Perimeter) only RoS shows in the Table Filters / Outputs.

I'm a bit skeptical Re-Posh is the issue, since that should re-trigger
any subscriptions (Re-Posh listens to the DataScript DB for any
transaction).

Is it better to rely on reactive entity? IIRC, that is a faster lookup method as well?

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