Skip to content

fix: numbered list item decorations missed on initial render#2734

Merged
nperez0111 merged 2 commits into
mainfrom
fix-numbered-list-indices
May 11, 2026
Merged

fix: numbered list item decorations missed on initial render#2734
nperez0111 merged 2 commits into
mainfrom
fix-numbered-list-indices

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

@matthewlipski matthewlipski commented May 11, 2026

Summary

This PR fixes a bug introduced in #2600, where list item indices would not be visible on the initial render. They would only show for a given numbered list item block, after the editor content before it was changed. This is because the decoration updates only occur when a transaction has a changedRange, which is not the case when the editor is first initialized.

To fix this, if changedRange is null, the extension scans the whole document to apply decorations, rather than returning early.

Rationale

This is a bug.

Changes

See above.

Impact

N/A

Testing

An e2e test for this ("Check static rendering visually matches live editor" in static.test.ts) is already present and shows the issue in the screenshot output. This e2e test wasn't updated in #2600, which caused the issue, and was then updated in #2690 without the mistake being caught. The screenshot has been updated in this PR.

Screenshots/Video

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Fixed numbered list items not displaying correct indexing on initial load.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

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

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview May 11, 2026 4:23pm
blocknote-website Ready Ready Preview May 11, 2026 4:23pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (3)
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-webkit-linux.png is excluded by !**/*.png

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd9be92d-86e9-4b39-948b-4c0ee56ad3cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The IndexingPlugin's getDecorations function now correctly handles the initial plugin state by performing a full-document decoration scan when no transaction changes are present, instead of returning early with unmapped decorations.

Changes

Initial Plugin State Handling

Layer / File(s) Summary
Decoration Calculation Fallback
packages/core/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
When tr.changedRange() returns null, the plugin now scans the entire document (from 0 to tr.doc.nodeSize - 2) to recalculate decorations, instead of returning early with previously mapped decorations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • nperez0111

Poem

🐰 A plugin's first breath now runs true,
No more early returns, the whole doc's in view,
When changes are null, we scan every line,
Initial state indexes—now perfectly fine! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main bug being fixed: numbered list item decorations not appearing on initial render.
Description check ✅ Passed The description follows the template structure with all major sections completed, including detailed explanation of the bug, rationale, changes, testing approach, and checklist status.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-numbered-list-indices

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

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

Open in StackBlitz

@blocknote/ariakit

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

@blocknote/code-block

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

@blocknote/core

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

@blocknote/mantine

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

@blocknote/react

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

@blocknote/server-util

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

@blocknote/shadcn

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

@blocknote/xl-ai

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

@blocknote/xl-docx-exporter

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

@blocknote/xl-email-exporter

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

@blocknote/xl-multi-column

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

@blocknote/xl-odt-exporter

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

@blocknote/xl-pdf-exporter

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

commit: ef3fc74

Copy link
Copy Markdown
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@nperez0111 nperez0111 changed the title fix: Numbered list item decorations not being created on initial render fix: numbered list item decorations missed on initial render May 11, 2026
@nperez0111 nperez0111 merged commit 41b9151 into main May 11, 2026
13 checks passed
@nperez0111 nperez0111 deleted the fix-numbered-list-indices branch May 11, 2026 16:24
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