Skip to content

BHP1-1569 Fix table filters not saving#260

Open
rjsheperd wants to merge 2 commits into
mainfrom
rj-BHP1-1569-fix-table-filters-not-saving
Open

BHP1-1569 Fix table filters not saving#260
rjsheperd wants to merge 2 commits into
mainfrom
rj-BHP1-1569-fix-table-filters-not-saving

Conversation

@rjsheperd

Copy link
Copy Markdown
Contributor

Purpose

  • Stop re-runs from overwriting table filter ranges
  • Forces syncing of the pending tx-data

Related Issues

Closes BHP1-1569

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 the following worksheet:
  2. Verify that the minimum spread rate is set to 30 ch/h after running
    the worksheet
  3. Edit the range (e.g. 20), then immediately reload/close the tab; reopen and confirm the
    edit survived the sync debounce window.
  4. Run the CLJS tests: worksheet_events_test.cljs

@rjsheperd rjsheperd force-pushed the rj-BHP1-1569-fix-table-filters-not-saving branch from 4d043ff to 3061a62 Compare June 30, 2026 00:54
@rjsheperd rjsheperd changed the title Rj bhp1 1569 fix table filters not saving BHP1-1569 Fix table filters not saving Jun 30, 2026
@Kcheung42

Kcheung42 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

I'm running into an issue with the figwheel testing.

image

@Kcheung42

Kcheung42 commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Updated behave/test/cljs/behave/test_runner.cljs and was able to get the tests to run. Seems one part of the test is still failing regarding the initial seed of the table filters.

image
(defn- load-wasm-module!
  "Bootstraps the Emscripten WASM module for the test harness.

  `behave-min.js` is a MODULARIZE build: it exposes a `createModule()` factory
  and does NOT define a global `Module` until that factory is called (see the
  main app's bootstrap in `behave.views/cljs-init` and `resources/onload.js`).
  We mirror that here so the test bundle works on host pages that do not load
  the WASM glue for us (notably figwheel's `/figwheel-extra-main/testing`).

  Re-enters `init` once `window.Module` is set."
  [init]
  (if (exists? js/createModule)
    ;; behave-min.js is already on the page (e.g. the /api/test host page) —
    ;; just instantiate the module.
    (-> (js/createModule)
        (.then (fn [instance]
                 (set! (.-Module js/window) instance)
                 (init))))
    ;; No WASM glue on the page (figwheel extra-main host page): load it, then
    ;; retry — the retry hits the `createModule` branch above.
    (let [script (.createElement js/document "script")]
      (set! (.-src script) "/js/behave-min.js")
      (set! (.-onload script) (fn [] (init)))
      (.appendChild (.-body js/document) script))))

(defn ^:after-load init []
  (let [module-loaded? (some? (.-Module js/window))
        vms-loaded?    @(rf/subscribe [:state :vms-loaded?])]

    (cond
      (not module-loaded?)
      (load-wasm-module! init)

      (not vms-loaded?)
      (do
        (load-vms!)
        (js/setTimeout #(init) 1000))

      :else
      (run-the-tests))))


@Kcheung42

Copy link
Copy Markdown
Collaborator

The fix it self is verified and working, just the tests failing

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