File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -368,17 +368,7 @@ function createStorage(): WxtStorage {
368368 driverKey ,
369369 driverMetaKey ,
370370 ] ) ;
371- if ( value == null ) {
372- if ( targetVersion > 1 ) {
373- await setMeta ( driver , driverKey , { v : targetVersion } ) ;
374- if ( debug === true ) {
375- console . debug (
376- `[@wxt-dev/storage] Set meta for ${ driverKey } v${ targetVersion } ` ,
377- ) ;
378- }
379- }
380- return ;
381- }
371+ if ( value == null ) return ;
382372
383373 const currentVersion = meta ?. v ?? 1 ;
384374 if ( currentVersion > targetVersion ) {
@@ -446,6 +436,9 @@ function createStorage(): WxtStorage {
446436 const getOrInitValue = ( ) =>
447437 initMutex . runExclusive ( async ( ) => {
448438 const value = await driver . getItem < any > ( driverKey ) ;
439+ if ( value == null && targetVersion > 1 )
440+ await setMeta ( driver , driverKey , { v : targetVersion } ) ;
441+
449442 // Don't init value if it already exists or the init function isn't provided
450443 if ( value != null || opts ?. init == null ) return value ;
451444
You can’t perform that action at this time.
0 commit comments