Skip to content

Take the style library without lodash (#356) - #434

Merged
adamjohnwright merged 2 commits into
mainfrom
perf/356-embed-without-lodash
Oct 13, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
perf/356-embed-without-lodash

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Part of #356. It follows #432 (router) and reactome/ngx-reactome-base#15.

What it does

  • The style library without lodash. cytoscape-style: drop lodash for small local memoize and throttle ngx-reactome-base#15 removed lodash from ngx-reactome-cytoscape-style. Its four uses became native code or a small local memoize/throttle, each held to lodash's behaviour by a spec that runs lodash alongside. The review there checked the throttle against lodash's source branch by branch.
  • The lockfile moves the library to that build (76de66a, built from dc16af7) by its entry alone.
    • npm update also rewrote unrelated entries: it dropped peer packages and flipped dev flags. So the entry was edited by hand and checked with npm ci.
    • The library build is the only thing that changed since the pinned one.
  • ehld.service's one isArray is now Array.isArray.

With #432, which took the state service's lodash imports, nothing the embed loads imports lodash.

Size. On main + this PR, the embed's JavaScript is 1,496 KB, down from 1,650 KB before #432, with 1.43 MB initial. lodash and @angular/router are both at 0 in the stats.

Checks

  • Unit tests: 723 passed.
  • Diagram e2e (diagram behaviour, pathway browser, downloads, disease compare, interactors, embed, analysis, EHLD): 109 passed.
  • Preflight passes, including lockfile drift and the live render.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits October 13, 2026 05:58
ngx-reactome-cytoscape-style no longer imports lodash
(reactome/ngx-reactome-base#15): its four uses are native code or small local
memoize/throttle held to lodash's behaviour by spec. The lockfile moves the
library to that build (76de66a, built from dc16af7) by its entry alone --
`npm update` also rewrote unrelated entries, so it was edited and checked
with `npm ci` instead. ehld.service's one isArray is Array.isArray.

With the router change (#432), which takes the state service's lodash
imports, nothing the embed loads imports lodash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…spec guards

It was inlined for its CommonJS lodash import, which is gone. All 84 spec
files pass without the option; the interop spec still imports the library
directly, so a build that brings back a CommonJS-only import fails there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright

Copy link
Copy Markdown
Contributor Author

Review (subagent, adversarial): no defects. The hand-edited lock entry matches 76de66a's package.json exactly and uses the same git+ssh#sha form, so npm ci fetches exactly that build (git dependencies carry no integrity field); the library diff between the two builds is only the bundle (local memoize, faithful throttle port, Array.isArray, typeof) with an unchanged d.ts; WebsiteAngular uses only Style, extract, ReactomeEventTypes and INTERACTOR_BADGE_MIN_ZOOM; lodash stays declared here for five details components. Loose ends fixed in the latest commit: vitest.config.ts no longer inlines the library (it was there for the lodash import; all 84 spec files pass without it), and the interop spec says what it guards now.

@adamjohnwright
adamjohnwright merged commit 258c2ef into main Oct 13, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the perf/356-embed-without-lodash branch October 13, 2026 06:44
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.

1 participant