Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export const GlobalNotice = ( { message, title, options } ) => {

return (
<div className={ styles.notice }>
<Notice.Root intent={ options.level || 'info' }>
{ /* A string `spokenMessage`: by default Root renderToString()s its children mid-render, running their hooks as its own. */ }
<Notice.Root
intent={ options.level || 'info' }
spokenMessage={ [ title, typeof message === 'string' ? message : null ]
.filter( Boolean )
.join( ' ' ) }
>
{ title && <Notice.Title>{ title }</Notice.Title> }
{ /* `render={ <div /> }`: `message` can carry block content, but Description defaults to a `span`. */ }
<Notice.Description className={ styles.message } render={ <div /> }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<GlobalNotice message="Incomplete install" options={ { id: 'bad', actions: [ action ] } } />
);

rerender(
<GlobalNotice
message="Connect"
title="Missing site connection"
options={ { id: 'missing-connection', actions: [ action ] } }
/>
);

expect( screen.getByText( 'Missing site connection' ) ).toBeInTheDocument();
} );

it( 'hides the close button by default', () => {
render( <GlobalNotice message="Body" title="Title" options={ { id: 'seo' } } /> );

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

My Jetpack: Fix the dashboard crashing with "Something went wrong" when one notice replaces another.
Loading