A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

Tests: silence act() warnings in PublishPanel teardown

The PublishPanel submit/publish handlers are async, which arms React's
act-tracking after the click's act() scope closes. A subsequent bare
root.unmount() then flushes that pending state update outside act() and
logs a "not wrapped in act" warning. Pre-flushing before unmount doesn't
help — the unmount's own flushSync has to run inside act().

Wrap root.unmount() in act() in both clickUpdate and clickPublish. This
also clears two equivalent warnings that already existed via clickUpdate
before the publish-success-pill work added clickPublish.

+10 -2
+10 -2
src/components/PublishPanel.test.tsx
··· 70 70 await act( async () => { 71 71 button.dispatchEvent( new MouseEvent( 'click', { bubbles: true } ) ); 72 72 } ); 73 - root.unmount(); 73 + // The submit handler is async, so a state update can still be settling at 74 + // teardown; unmount inside act() so it isn't flagged "not wrapped in act". 75 + await act( async () => { 76 + root.unmount(); 77 + } ); 74 78 container.remove(); 75 79 } 76 80 ··· 114 118 new MouseEvent( 'click', { bubbles: true } ) 115 119 ); 116 120 } ); 117 - root.unmount(); 121 + // The publish handler is async, so a state update can still be settling at 122 + // teardown; unmount inside act() so it isn't flagged "not wrapped in act". 123 + await act( async () => { 124 + root.unmount(); 125 + } ); 118 126 container.remove(); 119 127 } 120 128