Page MenuHomePhabricator

D5860.diff
No OneTemporary

D5860.diff

diff --git a/landing/investors.react.js b/landing/investors.react.js
--- a/landing/investors.react.js
+++ b/landing/investors.react.js
@@ -13,7 +13,9 @@
const { pushModal } = useModalContext();
const onClickInvestorProfileCard = React.useCallback(
- (id: string) => pushModal(<InvestorProfileModal investorID={id} />),
+ (id: string) => {
+ pushModal(<InvestorProfileModal investorID={id} />);
+ },
[pushModal],
);
diff --git a/lib/components/modal-provider.react.js b/lib/components/modal-provider.react.js
--- a/lib/components/modal-provider.react.js
+++ b/lib/components/modal-provider.react.js
@@ -5,12 +5,14 @@
import { getUUID } from '../utils/uuid';
+export type PushModal = React.Node => string;
+
type Props = {
+children: React.Node,
};
type ModalContextType = {
+modals: $ReadOnlyArray<[React.Node, string]>,
- +pushModal: React.Node => void,
+ +pushModal: PushModal,
+popModal: () => void,
+clearModals: () => void,
};
@@ -18,7 +20,7 @@
const ModalContext: React.Context<?ModalContextType> = React.createContext<?ModalContextType>(
{
modals: [],
- pushModal: () => {},
+ pushModal: () => '',
popModal: () => {},
clearModals: () => {},
},
@@ -36,6 +38,7 @@
const pushModal = React.useCallback(newModal => {
const key = getUUID();
setModals(oldModals => [...oldModals, [newModal, key]]);
+ return key;
}, []);
const clearModals = React.useCallback(() => setModals([]), []);
diff --git a/web/calendar/day.react.js b/web/calendar/day.react.js
--- a/web/calendar/day.react.js
+++ b/web/calendar/day.react.js
@@ -10,7 +10,10 @@
createLocalEntry,
createLocalEntryActionType,
} from 'lib/actions/entry-actions';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import { onScreenThreadInfos as onScreenThreadInfosSelector } from 'lib/selectors/thread-selectors';
import { entryKey } from 'lib/shared/entry-utils';
import type { EntryInfo } from 'lib/types/entry-types';
@@ -45,7 +48,7 @@
+nextLocalID: number,
+timeZone: ?string,
+dispatch: Dispatch,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
+popModal: () => void,
};
type State = {
diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js
--- a/web/calendar/entry.react.js
+++ b/web/calendar/entry.react.js
@@ -14,7 +14,10 @@
deleteEntry,
concurrentModificationResetActionType,
} from 'lib/actions/entry-actions';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import { threadInfoSelector } from 'lib/selectors/thread-selectors';
import { entryKey } from 'lib/shared/entry-utils';
import { colorIsDark, threadHasPermission } from 'lib/shared/thread-utils';
@@ -68,7 +71,7 @@
+createEntry: (info: CreateEntryInfo) => Promise<CreateEntryPayload>,
+saveEntry: (info: SaveEntryInfo) => Promise<SaveEntryResult>,
+deleteEntry: (info: DeleteEntryInfo) => Promise<DeleteEntryResult>,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
+popModal: () => void,
};
type State = {
diff --git a/web/calendar/filter-panel.react.js b/web/calendar/filter-panel.react.js
--- a/web/calendar/filter-panel.react.js
+++ b/web/calendar/filter-panel.react.js
@@ -12,7 +12,10 @@
import { useDispatch } from 'react-redux';
import Switch from 'react-switch';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import {
filteredThreadIDsSelector,
includeDeletedSelector,
@@ -42,7 +45,7 @@
+filteredThreadIDs: ?$ReadOnlySet<string>,
+includeDeleted: boolean,
+dispatch: Dispatch,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
};
type State = {
+query: string,
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -28,7 +28,10 @@
type MultimediaUploadCallbacks,
type MultimediaUploadExtras,
} from 'lib/actions/upload-actions';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import { getNextLocalUploadID } from 'lib/media/media-utils';
import { pendingToRealizedThreadIDsSelector } from 'lib/selectors/thread-selectors';
import {
@@ -110,7 +113,7 @@
text: string,
) => Promise<SendMessageResult>,
+newThread: (request: ClientNewThreadRequest) => Promise<NewThreadResult>,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
+sendCallbacks: $ReadOnlyArray<() => mixed>,
+registerSendCallback: (() => mixed) => void,
+unregisterSendCallback: (() => mixed) => void,
diff --git a/web/media/multimedia.react.js b/web/media/multimedia.react.js
--- a/web/media/multimedia.react.js
+++ b/web/media/multimedia.react.js
@@ -10,7 +10,10 @@
AlertCircle as AlertCircleIcon,
} from 'react-feather';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import type { MediaType } from 'lib/types/media-types';
import Button from '../components/button.react';
@@ -28,7 +31,7 @@
};
type Props = {
...BaseProps,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
};
class Multimedia extends React.PureComponent<Props> {
diff --git a/web/modals/account/log-in-first-modal.react.js b/web/modals/account/log-in-first-modal.react.js
--- a/web/modals/account/log-in-first-modal.react.js
+++ b/web/modals/account/log-in-first-modal.react.js
@@ -2,7 +2,10 @@
import * as React from 'react';
-import { useModalContext } from 'lib/components/modal-provider.react';
+import {
+ useModalContext,
+ type PushModal,
+} from 'lib/components/modal-provider.react';
import css from '../../style.css';
import Modal from '../modal.react';
@@ -14,7 +17,7 @@
type Props = {
...BaseProps,
- +pushModal: (modal: React.Node) => void,
+ +pushModal: PushModal,
+popModal: () => void,
};
diff --git a/web/settings/relationship/block-list-modal.react.js b/web/settings/relationship/block-list-modal.react.js
--- a/web/settings/relationship/block-list-modal.react.js
+++ b/web/settings/relationship/block-list-modal.react.js
@@ -29,10 +29,9 @@
const { onClose } = props;
const { pushModal } = useModalContext();
- const openBlockUsersModal = React.useCallback(
- () => pushModal(<BlockUsersModal onClose={onClose} />),
- [onClose, pushModal],
- );
+ const openBlockUsersModal = React.useCallback(() => {
+ pushModal(<BlockUsersModal onClose={onClose} />);
+ }, [onClose, pushModal]);
return (
<UserListModal
diff --git a/web/settings/relationship/friend-list-modal.react.js b/web/settings/relationship/friend-list-modal.react.js
--- a/web/settings/relationship/friend-list-modal.react.js
+++ b/web/settings/relationship/friend-list-modal.react.js
@@ -38,10 +38,9 @@
const { onClose } = props;
const { pushModal } = useModalContext();
- const openNewFriendsModal = React.useCallback(
- () => pushModal(<AddFriendsModal onClose={onClose} />),
- [onClose, pushModal],
- );
+ const openNewFriendsModal = React.useCallback(() => {
+ pushModal(<AddFriendsModal onClose={onClose} />);
+ }, [onClose, pushModal]);
return (
<UserListModal

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 12:45 PM (20 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677348
Default Alt Text
D5860.diff (7 KB)

Event Timeline