Skip to content

[BHP1-1673] Patch posh query reactions so disposed ones can be collected - #315

Merged
rjsheperd merged 2 commits into
mainfrom
rj-BHP1-1673-posh-reaction-leak
Oct 9, 2026
Merged

rjsheperd merged 2 commits into
mainfrom
rj-BHP1-1673-posh-reaction-leak

Conversation

@rjsheperd

Copy link
Copy Markdown
Contributor

Purpose

posh 0.5.7 make-query-reaction builds a subscription reaction in the same JS scope as
the posh-atom-with-query snapshot, so every reaction would preserve the whole posh
state at its creation. This causes the number of subscriptions/reactions forever (~223 per solve,
~60 % of the JS heap growth).

This PR vendors posh to create a separate fn (new-query-reaction)
to break the chain.

Related Issues

Part of BHP1-1673

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 any worksheet with a ranged input. Run it 10 times.
  2. Results, Review Run and the wizard pages update as on main.
  3. Open DevTools > Memory > heap snapshot after run 2 and
    run 10. Verify that the retained Reaction count stays flat instead of growing.

@Kcheung42

Kcheung42 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Looks good! Here's what I'm seeing the cached reaction count from 1st run to the 10th run

On this Branch: 20% increase

image

After 10 runs:
image

On main: 1400% increase
image

After 10 runs:
image

@rjsheperd
rjsheperd merged commit e78c644 into main Oct 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants