@@ -67,20 +67,22 @@ export default function SidebarNavigationScreenPages() {
67
67
68
68
const isHomePageBlog = frontPage === postsPage ;
69
69
70
- if ( ! isHomePageBlog && pages ?. length ) {
71
- const homePageIndex = pages . findIndex (
70
+ const reorderedPages = pages && [ ...pages ] ;
71
+
72
+ if ( ! isHomePageBlog && reorderedPages ?. length ) {
73
+ const homePageIndex = reorderedPages . findIndex (
72
74
( item ) => item . id === frontPage
73
75
) ;
74
- const homePage = pages . splice ( homePageIndex , 1 ) ;
75
- pages ?. splice ( 0 , 0 , ...homePage ) ;
76
+ const homePage = reorderedPages . splice ( homePageIndex , 1 ) ;
77
+ reorderedPages ?. splice ( 0 , 0 , ...homePage ) ;
76
78
77
- const postsPageIndex = pages . findIndex (
79
+ const postsPageIndex = reorderedPages . findIndex (
78
80
( item ) => item . id === postsPage
79
81
) ;
80
82
81
- const blogPage = pages . splice ( postsPageIndex , 1 ) ;
83
+ const blogPage = reorderedPages . splice ( postsPageIndex , 1 ) ;
82
84
83
- pages . splice ( 1 , 0 , ...blogPage ) ;
85
+ reorderedPages . splice ( 1 , 0 , ...blogPage ) ;
84
86
}
85
87
86
88
return (
@@ -114,7 +116,7 @@ export default function SidebarNavigationScreenPages() {
114
116
</ Truncate >
115
117
</ PageItem >
116
118
) }
117
- { pages ?. map ( ( item ) => {
119
+ { reorderedPages ?. map ( ( item ) => {
118
120
let itemIcon ;
119
121
switch ( item . id ) {
120
122
case frontPage :
0 commit comments