Skip to content

refactor: remove AI Lodash dependencies and simplify workspace code - #3119

Merged
nperez0111 merged 2 commits into
mainfrom
split/ai-dependency-cleanup
Oct 26, 2026
Merged

nperez0111 merged 2 commits into
mainfrom
split/ai-dependency-cleanup

Conversation

@nperez0111

@nperez0111 nperez0111 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Second PR in the stack: #3118 → this PR → core emoji data → React picker.

These changes were done by the e18e cli

Removes the direct Lodash equality and merge dependencies in the AI package. The request-composition change replaces document snapshots and tool definitions without recursive array merges. Includes targeted AI regression tests, the small source cleanups from #2903, and aligned Vitest workspace dependency metadata. Preserves the keyboard-shortcut fix already present on main.

Verified: core, React, and xl-ai builds; 12 targeted AI tests.

Original work: #2903.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of empty or missing content in block, comment, link, and thread operations.
    • AI request updates now replace arrays as a whole instead of merging their entries.
  • Refactor
    • Simplified internal handling of lists, sorting, and color calculations without changing their expected results.
  • Tests
    • Added coverage for AI request updates and schema definition comparisons.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9f6c9c96-b7d8-40f9-87ac-c04eb2bead9c
Commits

Reviewing files that changed from the base of the PR and between bb54d74 and 4a4a165.

Files ignored due to path filters: 1
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 12
  • packages/core/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts
  • packages/core/src/api/blockManipulation/tables/tables.test.ts
  • packages/core/src/api/getBlockInfoFromPos.ts
  • packages/core/src/api/nodeConversions/nodeToBlock.ts
  • packages/core/src/api/parsers/markdown/markdownToHtml.ts
  • packages/core/src/editor/managers/BlockManager.ts
  • packages/core/src/editor/managers/ExtensionManager/index.ts
  • packages/core/src/extensions/SideMenu/blockDropHandling.ts
  • packages/core/src/extensions/tiptap-extensions/Link/helpers/autolink.ts
  • packages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
  • packages/xl-ai/package.json
  • packages/xl-ai/src/streamTool/jsonSchema.test.ts
Files with no reviewable changes: 1
  • packages/xl-ai/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The changes update array and object operations across core, React, and AI code. They add checks for some empty-value cases, replace deep merges in AI request construction with shallow spreads, and replace Lodash schema comparison with local recursive equality.

Changes: Core and AI code updates

Layer / File(s) Summary
Block positions and content conversion
packages/core/src/api/getBlockInfoFromPos.ts, packages/core/src/api/nodeConversions/nodeToBlock.ts, packages/core/src/api/parsers/markdown/markdownToHtml.ts, packages/core/src/api/getBlocksChangedByTransaction.ts, packages/core/src/editor/transformPasted.ts, packages/core/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts, packages/core/src/api/blockManipulation/tables/tables.test.ts
Block-position lookup now throws when no block containers exist and preserves a matching position of zero. Content conversion checks for missing link items. Related array access and test fixture construction also change.
Editor utilities and comment handling
packages/core/src/comments/threadstore/TipTapThreadStore.ts, packages/react/src/components/Comments/ThreadsSidebar.tsx, packages/react/src/hooks/useStore.ts, packages/core/src/editor/managers/BlockManager.ts, packages/core/src/editor/managers/ExtensionManager/index.ts, packages/core/src/extensions/SideMenu/blockDropHandling.ts, packages/core/src/extensions/tiptap-extensions/Link/helpers/*, packages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts, packages/core/src/util/string.ts, packages/core/src/y/extensions/YCursorPlugin.ts, packages/core/src/yjs/extensions/YCursorPlugin.ts
Comment insertion now checks for an empty thread, and thread sorting falls back to the thread creation time when there are no comments. Other helpers update array, property, and exponentiation operations.
AI request construction
packages/xl-ai/src/api/aiRequest/sendMessageWithAIRequest.ts, packages/xl-ai/src/api/aiRequest/sendMessageWithAIRequest.test.ts, packages/xl-ai/package.json
AI request metadata and options are rebuilt with shallow spreads. Tests cover metadata replacement, option preservation, and omitted inputs. The package removes Lodash merge dependencies.
Stream-tool schema comparison
packages/xl-ai/src/streamTool/jsonSchema.ts, packages/xl-ai/src/streamTool/jsonSchema.test.ts
Schema definitions use local recursive comparison for duplicate $defs keys. Tests cover equivalent and differing definitions, separate names, and empty definitions.
AI tool and message access
packages/xl-ai/src/api/formats/base-tools/createAddBlocksTool.ts, packages/xl-ai/src/components/FormattingToolbar/AIToolbarButton.tsx, packages/xl-ai/src/prosemirror/changeset.ts, packages/xl-ai-server/src/routes/mock.ts, packages/xl-ai-server/src/routes/serverPersistence.ts
AI tool, toolbar, change-set, and server route code updates last-element access. Empty selection and missing last-element cases receive explicit checks.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Possibly related PRs

  • TypeCellOS/BlockNote#3118: This PR is the stated predecessor in the stack and changes package publication to ESM-only; this PR removes Lodash dependencies and updates the packages/xl-ai package metadata.
  • TypeCellOS/BlockNote#3236: Both PRs change the ExtensionManager replacement path and its registration inputs.

Suggested reviewers: matthewlipski, yousefed

Merge Risk: Minimal · up to 4a4a1

No concrete issue in the supplied evidence currently blocks merging; complete the normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 33 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "refactor: remove AI Lodash dependencies and simplify workspace code" matches the main change. The xl-ai package drops lodash.isequal and lodash.merge, and the diff includes several small cl…
Description check Passed The description covers the summary, rationale-like context, changes, and testing. It states that the change removes Lodash equality and merge dependencies, replaces document snapshots and tool definit…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "refactor: remove AI Lodash dependencies and simplify workspace code" matches the main change. The xl-ai package drops lodash.isequal and lodash.merge, and the diff includes several small cleanups that use Array.prototype.at(-1) and Object.hasOwn. The title is specific and concise, and it follows a conventional commit style. The title covers the primary change, although it does not mention the many small source cleanups in core and react.

Full details: Description check

Explanation

The description covers the summary, rationale-like context, changes, and testing. It states that the change removes Lodash equality and merge dependencies, replaces document snapshots and tool definitions, adds targeted AI regression tests, includes source cleanups, and reports verified builds and 12 targeted AI tests. It does not follow the template headings (Rationale, Impact, Screenshots/Video, Checklist, Additional Notes are missing). The Impact section and the checklist are not addressed. The description also references a stack of other PRs, which is useful context but not in the template.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each list with care,
Finds the last item waiting there.
Fresh tools hop in with schemas neat,
Old merge helpers leave their seat.
The editor nibbles changes sweet.

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
blocknote Ready Ready Preview Oct 26, 2026 10:03am UTC
blocknote-website Ready Ready Preview Oct 26, 2026 10:03am UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@3119

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@3119

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@3119

@blocknote/diagram-block

npm i https://pkg.pr.new/@blocknote/diagram-block@3119

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@3119

@blocknote/math-block

npm i https://pkg.pr.new/@blocknote/math-block@3119

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@3119

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@3119

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@3119

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@3119

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@3119

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@3119

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@3119

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@3119

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@3119

@blocknote/xl-typst-exporter

npm i https://pkg.pr.new/@blocknote/xl-typst-exporter@3119

commit: 4a4a165

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-26 10:23 UTC

@nperez0111
nperez0111 force-pushed the split/ai-dependency-cleanup branch from bb54d74 to 4a4a165 Compare October 26, 2026 10:01
@nperez0111
nperez0111 merged commit d973540 into main Oct 26, 2026
37 checks passed
@nperez0111
nperez0111 deleted the split/ai-dependency-cleanup branch October 26, 2026 10:23

This branch was successfully deployed

2 active deployments
Preview – blocknote-website — 4a4a1657 Deployed Oct 26, 2026 by vercel[bot]
Preview – blocknote — 4a4a1657 Deployed Oct 26, 2026 by vercel[bot]
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