File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/edit-site/src/components/post-list Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ function useView( postType ) {
109109 return {
110110 ...initialView ,
111111 type,
112+ ...defaultLayouts [ type ] ,
112113 } ;
113114 } ) ;
114115
@@ -140,13 +141,15 @@ function useView( postType ) {
140141 // without affecting any other config.
141142 const onUrlLayoutChange = useEvent ( ( ) => {
142143 setView ( ( prevView ) => {
143- const layoutToApply = layout ?? LAYOUT_LIST ;
144- if ( layoutToApply === prevView . type ) {
144+ const newType = layout ?? LAYOUT_LIST ;
145+ if ( newType === prevView . type ) {
145146 return prevView ;
146147 }
148+
147149 return {
148150 ...prevView ,
149- type : layout ?? LAYOUT_LIST ,
151+ type : newType ,
152+ ...defaultLayouts [ newType ] ,
150153 } ;
151154 } ) ;
152155 } ) ;
@@ -168,6 +171,7 @@ function useView( postType ) {
168171 setView ( {
169172 ...newView ,
170173 type,
174+ ...defaultLayouts [ type ] ,
171175 } ) ;
172176 }
173177 } ) ;
You can’t perform that action at this time.
0 commit comments