From a5c5c05f3dd7cf006a4f03ffa07cb37812b606cc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 18:48:12 -0600 Subject: [PATCH 1/2] Dismiss the style-change snackbar after updating citations After a bibliography's style changes, edit.js shows a snackbar ("Citation style changed. N citations in this post still use the old style.") with an Update citations action. Updating from the sidebar panel left that snackbar on screen next to the result notice, still describing citations that had just been updated. updateCitations() now removes it by its notice ID before reporting the result. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS --- CHANGELOG.md | 4 ++++ src/hooks/use-citation-updates.js | 6 ++++++ src/hooks/use-citation-updates.test.js | 20 +++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b7743..f89f34b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- After **Update citations**, the "Citation style changed" snackbar is dismissed, so it no longer sits beside the result still saying citations use the old style. + ## [1.19.0] - 2026-11-06 ### Added diff --git a/src/hooks/use-citation-updates.js b/src/hooks/use-citation-updates.js index 3e6f72b..840fbd3 100644 --- a/src/hooks/use-citation-updates.js +++ b/src/hooks/use-citation-updates.js @@ -108,6 +108,12 @@ export function useCitationUpdates( clientId ) { ); } + // The style-change snackbar (edit.js) says citations still use the + // old style; once they are updated it is out of date, so drop it. + registry + .dispatch( noticesStore ) + .removeNotice( `borges-citation-style-${ clientId }` ); + registry .dispatch( noticesStore ) .createNotice( diff --git a/src/hooks/use-citation-updates.test.js b/src/hooks/use-citation-updates.test.js index dbde2a5..b175378 100644 --- a/src/hooks/use-citation-updates.test.js +++ b/src/hooks/use-citation-updates.test.js @@ -7,6 +7,7 @@ import { const mockUpdateBlockAttributes = jest.fn(); const mockCreateNotice = jest.fn(); +const mockRemoveNotice = jest.fn(); let mockBlocks = []; jest.mock( '@wordpress/data', () => ( { @@ -14,7 +15,10 @@ jest.mock( '@wordpress/data', () => ( { select: () => ( { getBlocks: () => mockBlocks } ), dispatch: ( store ) => store === 'core/notices' - ? { createNotice: mockCreateNotice } + ? { + createNotice: mockCreateNotice, + removeNotice: mockRemoveNotice, + } : { updateBlockAttributes: mockUpdateBlockAttributes }, } ), } ) ); @@ -61,6 +65,7 @@ describe( 'useCitationUpdates', () => { beforeEach( () => { mockUpdateBlockAttributes.mockClear(); mockCreateNotice.mockClear(); + mockRemoveNotice.mockClear(); mockBlocks = [ { clientId: 'p1', @@ -124,4 +129,17 @@ describe( 'useCitationUpdates', () => { expect.anything() ); } ); + + it( 'dismisses the style-change snackbar once citations are updated', () => { + const { result } = renderHook( () => useCitationUpdates( 'bib' ) ); + + result.current.updateCitations( false ); + + expect( mockRemoveNotice ).toHaveBeenCalledWith( + 'borges-citation-style-bib' + ); + expect( mockRemoveNotice.mock.invocationCallOrder[ 0 ] ).toBeLessThan( + mockCreateNotice.mock.invocationCallOrder[ 0 ] + ); + } ); } ); From fa74b12e5d44ca1a3965f20516e16b4ac05667bd Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 18:51:11 -0600 Subject: [PATCH 2/2] Update the JS source line count in current metrics Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WPtgA1cnwP9mYKwaWniaFS --- docs/current-metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/current-metrics.md b/docs/current-metrics.md index ed6b6ff..ee71ce6 100644 --- a/docs/current-metrics.md +++ b/docs/current-metrics.md @@ -13,7 +13,7 @@ Source and LOC figures last verified: **2026-10-06** against the heading-level b |---|---|---| | Main plugin file (`bibliography-builder.php`) | **823** | `wc -l bibliography-builder.php` | | All first-party PHP (excl. vendor, tests, scripts, playground, packages, output, node_modules, generated `build/`) | **18334** | `find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -not -path './tests/*' -not -path './packages/*' -not -path './scripts/*' -not -path './playground/*' -not -path './output/*' -not -path './build/*' -print0 \| xargs -0 wc -l \| tail -1` | -| JS source (`src/`, excl. `*.test.js`) | **16210** | `find ./src -name '*.js' -not -name '*.test.js' -print0 \| xargs -0 wc -l \| tail -1` | +| JS source (`src/`, excl. `*.test.js`) | **16216** | `find ./src -name '*.js' -not -name '*.test.js' -print0 \| xargs -0 wc -l \| tail -1` | | Shipped frontend runtime (`build/view.js`, minified) | **3,183 bytes** | `npm run build` then `wc -c < build/view.js` | The only PHP that executes at runtime on a visitor request path is `bibliography-builder.php`