Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3372063
D8246.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8246.diff
View Options
diff --git a/lib/reducers/invite-links-reducer.js b/lib/reducers/invite-links-reducer.js
--- a/lib/reducers/invite-links-reducer.js
+++ b/lib/reducers/invite-links-reducer.js
@@ -5,8 +5,13 @@
disableInviteLinkLinkActionTypes,
fetchPrimaryInviteLinkActionTypes,
} from '../actions/link-actions.js';
+import {
+ deleteAccountActionTypes,
+ logOutActionTypes,
+} from '../actions/user-actions.js';
import type { InviteLinksStore } from '../types/link-types.js';
import type { BaseAction } from '../types/redux-types.js';
+import { setNewSessionActionType } from '../utils/action-utils.js';
function reduceInviteLinks(
state: InviteLinksStore,
@@ -53,6 +58,15 @@
[communityID]: communityLinks,
},
};
+ } else if (
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success ||
+ (action.type === setNewSessionActionType &&
+ action.payload.sessionChange.cookieInvalidated)
+ ) {
+ return {
+ links: {},
+ };
}
return state;
}
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -41,6 +41,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';
@@ -192,6 +193,7 @@
<PolicyAcknowledgmentHandler />
<PushNotificationsHandler />
<InviteLinkHandler />
+ <InviteLinksRefresher />
{content}
</WagmiENSCacheProvider>
</WagmiConfig>
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,36 @@
+// @flow
+
+import * as React from 'react';
+
+import {
+ fetchPrimaryInviteLinkActionTypes,
+ fetchPrimaryInviteLinks,
+} from 'lib/actions/link-actions.js';
+import { isLoggedIn } from 'lib/selectors/user-selectors.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 loggedIn = useSelector(isLoggedIn);
+ const callFetchPrimaryLinks = useServerCall(fetchPrimaryInviteLinks);
+ const dispatchActionPromise = useDispatchActionPromise();
+
+ React.useEffect(() => {
+ if (!isActive || !loggedIn) {
+ return;
+ }
+ dispatchActionPromise(
+ fetchPrimaryInviteLinkActionTypes,
+ callFetchPrimaryLinks(),
+ );
+ }, [callFetchPrimaryLinks, dispatchActionPromise, isActive, loggedIn]);
+
+ return null;
+}
+
+export default InviteLinksRefresher;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 5:30 AM (22 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585178
Default Alt Text
D8246.diff (3 KB)
Attached To
Mode
D8246: [web] Refresh invite links
Attached
Detach File
Event Timeline
Log In to Comment