Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33079676
D7665.1768451588.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
D7665.1768451588.diff
View Options
diff --git a/web/database/sqlite-data-handler.js b/web/database/sqlite-data-handler.js
--- a/web/database/sqlite-data-handler.js
+++ b/web/database/sqlite-data-handler.js
@@ -1,12 +1,16 @@
// @flow
import * as React from 'react';
+import { useDispatch } from 'react-redux';
+
+import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js';
import { databaseModule } from './database-module-provider.js';
import { useSelector } from '../redux/redux-utils.js';
import { workerRequestMessageTypes } from '../types/worker-types.js';
function SQLiteDataHandler(): React.Node {
+ const dispatch = useDispatch();
const rehydrateConcluded = useSelector(
state => !!(state._persist && state._persist.rehydrated),
);
@@ -44,6 +48,7 @@
if (currentLoggedInUserID) {
await databaseModule.initDBForLoggedInUser(currentLoggedInUserID);
}
+
if (!rehydrateConcluded) {
return;
}
@@ -53,8 +58,29 @@
return;
}
await handleSensitiveData();
+ if (!currentLoggedInUserID) {
+ return;
+ }
+ const data = await databaseModule.schedule({
+ type: workerRequestMessageTypes.GET_CLIENT_STORE,
+ });
+
+ if (!data?.store?.drafts) {
+ return;
+ }
+ dispatch({
+ type: setClientDBStoreActionType,
+ payload: {
+ drafts: data.store.drafts,
+ },
+ });
})();
- }, [currentLoggedInUserID, handleSensitiveData, rehydrateConcluded]);
+ }, [
+ currentLoggedInUserID,
+ dispatch,
+ handleSensitiveData,
+ rehydrateConcluded,
+ ]);
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 4:33 AM (13 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5931111
Default Alt Text
D7665.1768451588.diff (1 KB)
Attached To
Mode
D7665: [web-db] read drafts from SQLite database and dispatch to store
Attached
Detach File
Event Timeline
Log In to Comment