Page MenuHomePhabricator

D8246.id27858.diff
No OneTemporary

D8246.id27858.diff

diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -40,6 +40,7 @@
import electron from './electron.js';
import InputStateContainer from './input/input-state-container.react.js';
import InviteLinkHandler from './invite-links/invite-link-handler.react.js';
+import InviteLinksRefresher from './invite-links/invite-links-refresher.react.js';
import LoadingIndicator from './loading-indicator.react.js';
import { MenuProvider } from './menu-provider.react.js';
import UpdateModalHandler from './modals/update-modal.react.js';
@@ -179,6 +180,7 @@
<PolicyAcknowledgmentHandler />
<PushNotificationsHandler />
<InviteLinkHandler />
+ <InviteLinksRefresher />
{content}
{this.props.modals}
</WagmiENSCacheProvider>
diff --git a/web/invite-links/invite-links-refresher.react.js b/web/invite-links/invite-links-refresher.react.js
new file mode 100644
--- /dev/null
+++ b/web/invite-links/invite-links-refresher.react.js
@@ -0,0 +1,34 @@
+// @flow
+
+import * as React from 'react';
+
+import {
+ fetchPrimaryInviteLinkActionTypes,
+ fetchPrimaryInviteLinks,
+} from 'lib/actions/link-actions.js';
+import {
+ useDispatchActionPromise,
+ useServerCall,
+} from 'lib/utils/action-utils.js';
+
+import { useSelector } from '../redux/redux-utils.js';
+
+function InviteLinksRefresher(): React.Node {
+ const isActive = useSelector(state => state.windowActive);
+ const callFetchPrimaryLinks = useServerCall(fetchPrimaryInviteLinks);
+ const dispatchActionPromise = useDispatchActionPromise();
+
+ React.useEffect(() => {
+ if (!isActive) {
+ return;
+ }
+ dispatchActionPromise(
+ fetchPrimaryInviteLinkActionTypes,
+ callFetchPrimaryLinks(),
+ );
+ }, [callFetchPrimaryLinks, dispatchActionPromise, isActive]);
+
+ return null;
+}
+
+export default InviteLinksRefresher;

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 2:48 PM (8 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585176
Default Alt Text
D8246.id27858.diff (1 KB)

Event Timeline