@@ -21,20 +21,20 @@ export const useMetaBoxInitialization = ( enabled ) => {
2121 const {
2222 isEnabledAndEditorReady,
2323 isCollaborationEnabled,
24- hasMetaBoxes,
25- allMetaBoxes,
24+ hasIncompatibleMetaBoxes,
2625 } = useSelect (
2726 ( select ) => ( {
2827 isEnabledAndEditorReady :
2928 enabled && select ( editorStore ) . __unstableIsEditorReady ( ) ,
3029 isCollaborationEnabled :
3130 select ( editorStore ) . isCollaborationEnabledForCurrentPost ( ) ,
32- hasMetaBoxes : enabled
33- ? select ( editPostStore ) . hasMetaBoxes ( )
31+ // Meta boxes marked with __rtc_compatible_meta_box on the server
32+ // carry an `__rtc_compatible` flag on their store entry.
33+ hasIncompatibleMetaBoxes : enabled
34+ ? select ( editPostStore )
35+ . getAllMetaBoxes ( )
36+ . some ( ( metaBox ) => ! metaBox . __rtc_compatible )
3437 : false ,
35- allMetaBoxes : enabled
36- ? select ( editPostStore ) . getAllMetaBoxes ( )
37- : undefined ,
3838 } ) ,
3939 [ enabled ]
4040 ) ;
@@ -48,24 +48,15 @@ export const useMetaBoxInitialization = ( enabled ) => {
4848 initializeMetaBoxes ( ) ;
4949
5050 // Disable real-time collaboration when legacy meta boxes are detected.
51- // Meta boxes marked with __rtc_compatible_meta_box on the server
52- // carry an `__rtc_compatible` flag on their store entry.
53- if ( isCollaborationEnabled ) {
54- const hasIncompatibleMetaBoxes = allMetaBoxes ?. some (
55- ( metaBox ) => ! metaBox . __rtc_compatible
56- ) ;
57-
58- if ( hasIncompatibleMetaBoxes ) {
59- setCollaborationSupported ( false ) ;
60- }
51+ if ( isCollaborationEnabled && hasIncompatibleMetaBoxes ) {
52+ setCollaborationSupported ( false ) ;
6153 }
6254 }
6355 } , [
6456 isEnabledAndEditorReady ,
6557 initializeMetaBoxes ,
6658 isCollaborationEnabled ,
6759 setCollaborationSupported ,
68- hasMetaBoxes ,
69- allMetaBoxes ,
60+ hasIncompatibleMetaBoxes ,
7061 ] ) ;
7162} ;
0 commit comments