diff --git a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx index 3f1ee120f87f..aa4840b7da5b 100644 --- a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx @@ -56,7 +56,13 @@ export const GlobalNotice = ( { message, title, options } ) => { return (
- + { /* A string `spokenMessage`: by default Root renderToString()s its children mid-render, running their hooks as its own. */ } + { title && { title } } { /* `render={
}`: `message` can carry block content, but Description defaults to a `span`. */ } }> diff --git a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/test/global-notice.test.jsx b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/test/global-notice.test.jsx index 702f5f61c67a..9e03f5b5e7c5 100644 --- a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/test/global-notice.test.jsx +++ b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/test/global-notice.test.jsx @@ -30,6 +30,23 @@ describe( 'GlobalNotice', () => { expect( recordEvent ).toHaveBeenCalledTimes( 1 ); } ); + it( 'keeps rendering when a higher-priority notice with a title replaces an untitled one', () => { + const action = { label: 'Act', onClick: jest.fn() }; + const { rerender } = render( + + ); + + rerender( + + ); + + expect( screen.getByText( 'Missing site connection' ) ).toBeInTheDocument(); + } ); + it( 'hides the close button by default', () => { render( ); diff --git a/projects/packages/my-jetpack/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/packages/my-jetpack/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..1294b7464132 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/backup/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/backup/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/backup/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/boost/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/boost/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/boost/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/jetpack/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/jetpack/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..cd08f5b5f288 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/protect/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/protect/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/protect/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/search/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/search/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/search/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/social/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/social/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/social/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/stats/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/stats/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/stats/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another. diff --git a/projects/plugins/videopress/changelog/fix-my-jetpack-global-notice-hook-crash b/projects/plugins/videopress/changelog/fix-my-jetpack-global-notice-hook-crash new file mode 100644 index 000000000000..dd52c50fcae2 --- /dev/null +++ b/projects/plugins/videopress/changelog/fix-my-jetpack-global-notice-hook-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.