diff --git a/lib/handlers/db-ops-handler.react.js b/lib/handlers/db-ops-handler.react.js new file mode 100644 --- /dev/null +++ b/lib/handlers/db-ops-handler.react.js @@ -0,0 +1,26 @@ +// @flow + +import * as React from 'react'; + +import { opsProcessingFinishedActionType } from '../actions/db-ops-actions.js'; +import { useDispatch, useSelector } from '../utils/redux-utils.js'; + +function DBOpsHandler(): React.Node { + const noOpsActions = useSelector(state => state.dbOpsStore.noOpsActions); + + const dispatch = useDispatch(); + + React.useEffect(() => { + if (noOpsActions.length === 0) { + return; + } + dispatch({ + type: opsProcessingFinishedActionType, + payload: { actionIDs: noOpsActions }, + }); + }, [noOpsActions, dispatch]); + + return null; +} + +export { DBOpsHandler }; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -31,6 +31,7 @@ import { MediaCacheProvider } from 'lib/components/media-cache-provider.react.js'; import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; import { StaffContextProvider } from 'lib/components/staff-provider.react.js'; +import { DBOpsHandler } from 'lib/handlers/db-ops-handler.react.js'; import { IdentitySearchProvider } from 'lib/identity-search/identity-search-context.js'; import { CallKeyserverEndpointProvider } from 'lib/keyserver-conn/call-keyserver-endpoint-provider.react.js'; import { TunnelbrokerProvider } from 'lib/tunnelbroker/tunnelbroker-context.js'; @@ -276,6 +277,7 @@ + ); let navigation; diff --git a/web/root.js b/web/root.js --- a/web/root.js +++ b/web/root.js @@ -13,6 +13,7 @@ import KeyserverConnectionsHandler from 'lib/components/keyserver-connections-handler.js'; import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; import ReportHandler from 'lib/components/report-handler.react.js'; +import { DBOpsHandler } from 'lib/handlers/db-ops-handler.react.js'; import { CallKeyserverEndpointProvider } from 'lib/keyserver-conn/call-keyserver-endpoint-provider.react.js'; import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; @@ -65,6 +66,7 @@ +