Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3531561
D9693.id32877.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D9693.id32877.diff
View Options
diff --git a/lib/components/integrity-handler.react.js b/lib/components/integrity-handler.react.js
--- a/lib/components/integrity-handler.react.js
+++ b/lib/components/integrity-handler.react.js
@@ -17,8 +17,9 @@
const threadInfos = useSelector(state => state.threadStore.threadInfos);
const integrityStore = useSelector(state => state.integrityStore);
- const [batches, setBatches] = React.useState(null);
- const timeout = React.useRef(null);
+ const [batches, setBatches] =
+ React.useState<?$ReadOnlyArray<$ReadOnlyArray<string>>>(null);
+ const timeout = React.useRef<?TimeoutID>(null);
React.useEffect(() => {
if (integrityStore.threadHashingStatus === 'starting') {
diff --git a/lib/components/modal-overlay.react.js b/lib/components/modal-overlay.react.js
--- a/lib/components/modal-overlay.react.js
+++ b/lib/components/modal-overlay.react.js
@@ -23,8 +23,8 @@
backgroundColor = 'var(--modal-overlay-background-90)',
} = props;
- const overlayRef = React.useRef();
- const firstClickRef = React.useRef(null);
+ const overlayRef = React.useRef<?HTMLDivElement>();
+ const firstClickRef = React.useRef<?HTMLElement>(null);
React.useLayoutEffect(() => {
if (overlayRef.current) {
diff --git a/lib/components/thread-draft-updater.react.js b/lib/components/thread-draft-updater.react.js
--- a/lib/components/thread-draft-updater.react.js
+++ b/lib/components/thread-draft-updater.react.js
@@ -17,7 +17,7 @@
);
const dispatch = useDispatch();
- const cachedThreadIDsRef = React.useRef();
+ const cachedThreadIDsRef = React.useRef<?Set<string>>();
if (!cachedThreadIDsRef.current) {
const newCachedThreadIDs = new Set();
for (const realizedThreadID of pendingToRealizedThreadIDs.values()) {
diff --git a/lib/hooks/disconnected-bar.js b/lib/hooks/disconnected-bar.js
--- a/lib/hooks/disconnected-bar.js
+++ b/lib/hooks/disconnected-bar.js
@@ -5,7 +5,10 @@
import { useDispatch } from 'react-redux';
import { connectionSelector } from '../selectors/keyserver-selectors.js';
-import { updateDisconnectedBarActionType } from '../types/socket-types.js';
+import {
+ updateDisconnectedBarActionType,
+ type ConnectionStatus,
+} from '../types/socket-types.js';
import { useSelector } from '../utils/redux-utils.js';
function useDisconnectedBarVisibilityHandler(networkConnected: boolean): void {
@@ -27,7 +30,7 @@
[disconnected, dispatch],
);
- const networkActiveRef = React.useRef(true);
+ const networkActiveRef = React.useRef<boolean>(true);
React.useEffect(() => {
networkActiveRef.current = networkConnected;
if (!networkConnected) {
@@ -35,7 +38,7 @@
}
}, [setDisconnected, networkConnected]);
- const prevConnectionStatusRef = React.useRef();
+ const prevConnectionStatusRef = React.useRef<?ConnectionStatus>();
const connectionStatus = connection.status;
const someRequestIsLate = connection.lateResponses.length !== 0;
React.useEffect(() => {
@@ -84,7 +87,7 @@
const { disconnected, shouldShowDisconnectedBar } =
useShouldShowDisconnectedBar();
- const prevShowDisconnectedBar = React.useRef();
+ const prevShowDisconnectedBar = React.useRef<?boolean>();
React.useEffect(() => {
const wasShowing = prevShowDisconnectedBar.current;
if (shouldShowDisconnectedBar && wasShowing === false) {
diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js
--- a/lib/hooks/search-threads.js
+++ b/lib/hooks/search-threads.js
@@ -34,7 +34,7 @@
threadInfo: ThreadInfo,
childThreadInfos: $ReadOnlyArray<U>,
): SearchThreadsResult<U> {
- const [searchState, setSearchState] = React.useState({
+ const [searchState, setSearchState] = React.useState<ThreadSearchState>({
text: '',
results: new Set<string>(),
});
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -1414,7 +1414,9 @@
const [threadSearchResults, setThreadSearchResults] = React.useState(
new Set(),
);
- const [usersSearchResults, setUsersSearchResults] = React.useState([]);
+ const [usersSearchResults, setUsersSearchResults] = React.useState<
+ $ReadOnlyArray<GlobalAccountUserInfo>,
+ >([]);
const threadSearchIndex = useGlobalThreadSearchIndex();
React.useEffect(() => {
(async () => {
diff --git a/lib/socket/activity-handler.react.js b/lib/socket/activity-handler.react.js
--- a/lib/socket/activity-handler.react.js
+++ b/lib/socket/activity-handler.react.js
@@ -12,6 +12,7 @@
import { getMostRecentNonLocalMessageID } from '../shared/message-utils.js';
import { threadIsPending } from '../shared/thread-utils.js';
import { queueActivityUpdatesActionType } from '../types/activity-types.js';
+import type { ConnectionStatus } from '../types/socket-types.js';
import { useDispatchActionPromise } from '../utils/action-utils.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -22,7 +23,7 @@
function ActivityHandler(props: Props): React.Node {
const { activeThread, frozen } = props;
- const prevActiveThreadRef = React.useRef();
+ const prevActiveThreadRef = React.useRef<?string>();
React.useEffect(() => {
prevActiveThreadRef.current = activeThread;
}, [activeThread]);
@@ -31,7 +32,7 @@
const connection = useSelector(connectionSelector);
invariant(connection, 'keyserver missing from keyserverStore');
const connectionStatus = connection.status;
- const prevConnectionStatusRef = React.useRef();
+ const prevConnectionStatusRef = React.useRef<?ConnectionStatus>();
React.useEffect(() => {
prevConnectionStatusRef.current = connectionStatus;
}, [connectionStatus]);
@@ -43,7 +44,7 @@
}
return getMostRecentNonLocalMessageID(activeThread, state.messageStore);
});
- const prevActiveThreadLatestMessageRef = React.useRef();
+ const prevActiveThreadLatestMessageRef = React.useRef<?string>();
React.useEffect(() => {
prevActiveThreadLatestMessageRef.current = activeThreadLatestMessage;
}, [activeThreadLatestMessage]);
@@ -51,7 +52,7 @@
prevActiveThreadLatestMessageRef.current;
const canSend = connectionStatus === 'connected' && !frozen;
- const prevCanSendRef = React.useRef();
+ const prevCanSendRef = React.useRef<?boolean>();
React.useEffect(() => {
prevCanSendRef.current = canSend;
}, [canSend]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 7:40 AM (12 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704340
Default Alt Text
D9693.id32877.diff (6 KB)
Attached To
Mode
D9693: [Flow202][lib][skip-ci] [1/23] Fix Flow issues with React hooks being underconstrained
Attached
Detach File
Event Timeline
Log In to Comment