fix(lib/storage): read options.load and act in Storage directly

This commit is contained in:
PalmDevs 2025-08-19 21:37:11 +07:00
parent 138b0dc651
commit 69fff07c1f
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -1,5 +1,3 @@
// TODO(storage): Implement using NativeModules interop instead
import { FileModule } from '@revenge-mod/discord/native'
import { getErrorStack } from '@revenge-mod/utils/error'
import { mergeDeep } from '@revenge-mod/utils/object'
@ -73,6 +71,8 @@ export function Storage<T extends AnyObject>(
)
}
}
if (options?.load) this.get()
}
// React is only initialized right before the init stage, so this is a dummy method
@ -94,8 +94,6 @@ export function getStorage<T extends AnyObject = AnyObject>(
const storage: Storage<T> = Object.create(Storage.prototype)
Storage.call(storage, path, options)
if (options?.load) storage.get()
return storage
}