@@ -246,6 +246,26 @@ persistencePlugin.__unstableMigrate = ( pluginOptions ) => {
246246 } ) ;
247247 }
248248
249+ let editPostState = state [ 'core/edit-post' ] ;
250+
251+ // Default `fullscreenMode` to `false` if any persisted state had existed
252+ // and the user hadn't made an explicit choice about fullscreen mode. This
253+ // is needed since `fullscreenMode` previously did not have a default value
254+ // and was implicitly false by its absence. It is now `true` by default, but
255+ // this change is not intended to affect upgrades from earlier versions.
256+ const hadPersistedState = Object . keys ( state ) . length > 0 ;
257+ const hadFullscreenModePreference = has ( state , [
258+ 'core/edit-post' ,
259+ 'preferences' ,
260+ 'features' ,
261+ 'fullscreenMode' ,
262+ ] ) ;
263+ if ( hadPersistedState && ! hadFullscreenModePreference ) {
264+ editPostState = merge ( { } , editPostState , {
265+ preferences : { features : { fullscreenMode : false } } ,
266+ } ) ;
267+ }
268+
249269 // Migrate 'areTipsEnabled' from 'core/nux' to 'showWelcomeGuide' in 'core/edit-post'
250270 const areTipsEnabled = get ( state , [
251271 'core/nux' ,
@@ -259,16 +279,17 @@ persistencePlugin.__unstableMigrate = ( pluginOptions ) => {
259279 'welcomeGuide' ,
260280 ] ) ;
261281 if ( areTipsEnabled !== undefined && ! hasWelcomeGuide ) {
262- persistence . set (
263- 'core/edit-post' ,
264- merge ( state [ 'core/edit-post' ] , {
265- preferences : {
266- features : {
267- welcomeGuide : areTipsEnabled ,
268- } ,
282+ editPostState = merge ( { } , editPostState , {
283+ preferences : {
284+ features : {
285+ welcomeGuide : areTipsEnabled ,
269286 } ,
270- } )
271- ) ;
287+ } ,
288+ } ) ;
289+ }
290+
291+ if ( editPostState !== state [ 'core/edit-post' ] ) {
292+ persistence . set ( 'core/edit-post' , editPostState ) ;
272293 }
273294} ;
274295
0 commit comments