@@ -98,7 +98,10 @@ export function mergeProps(
9898 return Object . keys ( toolbar ) . filter ( key => key !== 'ariaLabels' ) . length > 0 ? toolbar : null ;
9999}
100100
101- export function useMultiAppLayout ( props : SharedProps , isEnabled : boolean ) {
101+ export function useMultiAppLayout (
102+ props : SharedProps ,
103+ isEnabled : boolean
104+ ) : { registered : boolean ; toolbarProps : ToolbarProps | null } {
102105 const [ registration , setRegistration ] = useState < RegistrationState < SharedProps > | null > ( null ) ;
103106 const { forceDeduplicationType } = props ;
104107 const isToolbar = useAppLayoutFlagEnabled ( ) ;
@@ -111,9 +114,13 @@ export function useMultiAppLayout(props: SharedProps, isEnabled: boolean) {
111114 setRegistration ( { type : 'primary' , discoveredProps : [ ] } ) ;
112115 return ;
113116 }
114- return awsuiPluginsInternal . appLayoutWidget . register ( forceDeduplicationType , props =>
117+ const unregister = awsuiPluginsInternal . appLayoutWidget . register ( forceDeduplicationType , props =>
115118 setRegistration ( props as RegistrationState < SharedProps > )
116119 ) ;
120+ return ( ) => {
121+ unregister ( ) ;
122+ setRegistration ( { type : 'suspended' } ) ;
123+ } ;
117124 } , [ forceDeduplicationType , isEnabled , isToolbar ] ) ;
118125
119126 useLayoutEffect ( ( ) => {
@@ -124,7 +131,7 @@ export function useMultiAppLayout(props: SharedProps, isEnabled: boolean) {
124131
125132 if ( ! isToolbar ) {
126133 return {
127- registered : 'primary' ,
134+ registered : true ,
128135 // mergeProps is needed here because the toolbar's behavior depends on reconciliation logic
129136 // in this function. For example, navigation trigger visibility
130137 toolbarProps : mergeProps ( props , [ ] ) ,
0 commit comments