@@ -55,8 +55,8 @@ async function init() {
5555 }
5656 booting = true
5757 for ( let i = 0 ; i < 20 ; i ++ ) {
58- // Wait until config is available, for a max of 1s
59- if ( window . config . store ) {
58+ // Wait until config is available, or has thrown an error, for a max of 1s
59+ if ( window . config . store || window . configError ) {
6060 break
6161 }
6262 await new Promise ( ( resolve ) => setTimeout ( resolve , 50 ) )
@@ -65,7 +65,7 @@ async function init() {
6565
6666 // Check if the localstorage needs a flush.
6767 let cachekey = useLocalStorage ( 'cachekey' )
68- if ( cachekey . value !== window . config . cachekey ) {
68+ if ( window . config . cachekey && cachekey . value !== window . config . cachekey ) {
6969 window . config . flushable_localstorage_keys . forEach ( ( key ) => {
7070 useLocalStorage ( key ) . value = null
7171 } )
@@ -152,6 +152,14 @@ async function init() {
152152 } ,
153153 } ,
154154 mounted ( ) {
155+ window . $on ( 'configError' , ( ) => {
156+ app . config . globalProperties . configError . value = true
157+ throw new Error ( 'Config.js failed to load because of an error.' )
158+ } )
159+ if ( window . configError ?? false ) {
160+ window . $emit ( 'configError' )
161+ }
162+
155163 window . app . config . globalProperties . refs = this . $refs
156164 setTimeout ( ( ) => {
157165 const event = new CustomEvent ( 'vue:mounted' , { detail : { vue : window . app , rootNode : this } } )
@@ -178,6 +186,7 @@ async function init() {
178186 mask : useMask ( ) ,
179187 showTax : window . config . show_tax ,
180188 scrollLock : useScrollLock ( document . body ) ,
189+ configError : ref ( false ) ,
181190 // Wrap the local storage in getter and setter functions so you do not have to interact using .value
182191 guestEmail : wrapValue (
183192 useLocalStorage ( 'email' , window . debug ? 'wayne@enterprises.com' : '' , { serializer : StorageSerializers . string } ) ,
0 commit comments