Skip to content

fix: use XML hash for streaming shared strings#50

Closed
gwkline wants to merge 1 commit into
protobi:masterfrom
gwkline:master
Closed

fix: use XML hash for streaming shared strings#50
gwkline wants to merge 1 commit into
protobi:masterfrom
gwkline:master

Conversation

@gwkline

@gwkline gwkline commented Apr 30, 2026

Copy link
Copy Markdown

Summary

  • when streaming from a WorkbookWriter, having useSharedStrings enabled was causing strings to be incorrectly repeated, likely due to [object Object] counting as one string in the cache. This patch uses the XML representation of these strings for the purpose of cacheing to avoid this issue

Test plan

Before:
CleanShot 2026-04-30 at 11 31 42@2x

After:
CleanShot 2026-04-30 at 11 31 49@2x

Related to source code (for typings update)

protobi-pieter added a commit that referenced this pull request May 7, 2026
…up (#66)

* fix: use XML hash for streaming shared strings

* Add regression tests for richText shared-string deduplication

Covers the bug fixed in the cherry-picked commit: richText objects
previously collapsed to hash key '[object Object]', deduping every
richText cell into a single shared-string entry. Tests verify both
correct deduplication and distinction by formatting.

---------

Co-authored-by: Gavin Kline <gwkline23@gmail.com>
protobi-pieter added a commit that referenced this pull request May 7, 2026
Fixes critical bug in WorkbookWriter streaming with useSharedStrings:
every richText cell collapsed into a single shared-string entry
(richText objects coerced to '[object Object]' as hash key, deduping
all of them).

Cherry-picked from #50 by @gwkline; adds regression tests covering
richText deduplication and formatting-aware distinction. Addresses
upstream exceljs#2267.

Also pins uuid to ^9.0.1 to keep browserify build working
(uuid@14 dropped the main field; uuid@11 ships ES2021 syntax that
browserify@16 cannot parse).

Adds AGENTS.md with hard rules for AI-generated PRs.

Files changed:
- lib/utils/shared-strings.js: hash richText by rendered XML
- spec/unit/utils/shared-strings.spec.js: 2 new regression tests
- AGENTS.md: new (hard rules for AI agents)
- README.md, CONTRIBUTING.md: pointers to AGENTS.md, release notes
- .github/PULL_REQUEST_TEMPLATE.md: per-PR checklist
- FORK.md: release notes
- package.json, package-lock.json: version bump, uuid 8 -> 9

Tests: 886 unit tests passing (4 in SharedStrings, up from 2).

PRs: #64 (uuid), #65 (AGENTS.md), #66 (richText fix)
@gwkline

gwkline commented May 13, 2026

Copy link
Copy Markdown
Author

Thanks for pushing this along @protobi-admin!

@gwkline gwkline closed this May 13, 2026
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