| @@ -10,10 +10,11 @@ | ||
| 10 | 10 | getStringsShape, |
| 11 | 11 | getStyleShape, |
| 12 | 12 | } from '@auto-launch/fetchers/shape'; |
| 13 | 13 | import { clearSiteImages } from '@auto-launch/functions/wp'; |
| 14 | +import { launchStrings } from '@auto-launch/strings'; | |
| 15 | +import { siteImageUrls } from '@shared/lib/site-images'; | |
| 14 | 16 | import { safeLocalStorage } from '@shared/state/safe-local-storage'; |
| 15 | -import { __ } from '@wordpress/i18n'; | |
| 16 | 17 | import { create } from 'zustand'; |
| 17 | 18 | import { createJSONStorage, devtools, persist } from 'zustand/middleware'; |
| 18 | 19 | import { overrideWithUrlParams, urlParams, urlParamsShape } from './url-params'; |
| 19 | 20 | |
| @@ -26,9 +27,9 @@ | ||
| 26 | 27 | const initialState = { |
| 27 | 28 | go: false, |
| 28 | 29 | showExtendifyCodeScreen: false, |
| 29 | 30 | // translators: this is for a action log UI. Keep it short |
| 30 | - statusMessages: [__('Booting things up', 'extendify-local')], | |
| 31 | + statusMessages: [launchStrings().statusBooting], | |
| 31 | 32 | errorMessage: null, |
| 32 | 33 | errorCount: 0, |
| 33 | 34 | title: null, |
| 34 | 35 | description: null, |
| @@ -62,10 +63,8 @@ | ||
| 62 | 63 | title: undefined, |
| 63 | 64 | description: undefined, |
| 64 | 65 | descriptionBackup: undefined, |
| 65 | 66 | descriptionRaw: undefined, |
| 66 | - pulse: false, | |
| 67 | - setPulse: (value) => set({ pulse: value }), | |
| 68 | 67 | setData: (key, value) => { |
| 69 | 68 | if (!isValidKey(key)) return; |
| 70 | 69 | if (get()[key] === value) return; // avoid unnecessary updates |
| 71 | 70 | set({ [key]: value }); |
| @@ -172,9 +171,8 @@ | ||
| 172 | 171 | const { |
| 173 | 172 | statusMessages, |
| 174 | 173 | errorMessage, |
| 175 | 174 | errorCount, |
| 176 | - pulse, | |
| 177 | 175 | description, |
| 178 | 176 | descriptionRaw, |
| 179 | 177 | title, |
| 180 | 178 | showExtendifyCodeScreen, |
| @@ -180,11 +178,13 @@ | ||
| 180 | 178 | showExtendifyCodeScreen, |
| 181 | 179 | ...rest |
| 182 | 180 | } = state; |
| 183 | 181 | return Object.fromEntries( |
| 184 | - Object.entries(rest).filter(([, v]) => | |
| 185 | - Array.isArray(v) ? v.length > 0 : Boolean(v), | |
| 186 | - ), | |
| 182 | + Object.entries(rest).filter(([key, v]) => { | |
| 183 | + // An empty set means the fetch failed; keeping it skips the retry. | |
| 184 | + if (key === 'siteImages') return siteImageUrls(v).length > 0; | |
| 185 | + return Array.isArray(v) ? v.length > 0 : Boolean(v); | |
| 186 | + }), | |
| 187 | 187 | ); |
| 188 | 188 | }, |
| 189 | 189 | }), |
| 190 | 190 | state, |