Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32161808
D7667.1765043742.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D7667.1765043742.diff
View Options
diff --git a/web/redux/comm-redux-storage-engine.js b/web/redux/comm-redux-storage-engine.js
--- a/web/redux/comm-redux-storage-engine.js
+++ b/web/redux/comm-redux-storage-engine.js
@@ -1,10 +1,17 @@
// @flow
+import storage from 'redux-persist/es/storage/index.js';
+
import { databaseModule } from '../database/database-module-provider.js';
import { workerRequestMessageTypes } from '../types/worker-types.js';
const commReduxStorageEngine = {
getItem: async (key: string): Promise<string> => {
+ const isSupported = await databaseModule.isDatabaseSupported();
+ if (!isSupported) {
+ return await storage.getItem(key);
+ }
+
const result = await databaseModule.schedule({
type: workerRequestMessageTypes.GET_PERSIST_STORAGE_ITEM,
key,
@@ -15,6 +22,12 @@
return result.item;
},
setItem: async (key: string, item: string): Promise<void> => {
+ const isSupported = await databaseModule.isDatabaseSupported();
+ if (!isSupported) {
+ await storage.setItem(key, item);
+ return;
+ }
+
await databaseModule.schedule({
type: workerRequestMessageTypes.SET_PERSIST_STORAGE_ITEM,
key,
@@ -22,6 +35,12 @@
});
},
removeItem: async (key: string): Promise<void> => {
+ const isSupported = await databaseModule.isDatabaseSupported();
+ if (!isSupported) {
+ await storage.removeItem(key);
+ return;
+ }
+
await databaseModule.schedule({
type: workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM,
key,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 5:55 PM (20 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5838603
Default Alt Text
D7667.1765043742.diff (1 KB)
Attached To
Mode
D7667: [web-db] choose storage engine depending on whether database is supported or not
Attached
Detach File
Event Timeline
Log In to Comment