Page MenuHomePhabricator

D9693.diff
No OneTemporary

D9693.diff

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';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
@@ -28,7 +31,7 @@
[disconnected, dispatch],
);
- const networkActiveRef = React.useRef(true);
+ const networkActiveRef = React.useRef<boolean>(true);
React.useEffect(() => {
networkActiveRef.current = networkConnected;
if (!networkConnected) {
@@ -36,7 +39,7 @@
}
}, [setDisconnected, networkConnected]);
- const prevConnectionStatusRef = React.useRef();
+ const prevConnectionStatusRef = React.useRef<?ConnectionStatus>();
const connectionStatus = connection.status;
const someRequestIsLate = connection.lateResponses.length !== 0;
React.useEffect(() => {
@@ -85,7 +88,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
@@ -38,7 +38,7 @@
threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
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
@@ -1642,7 +1642,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';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
@@ -23,7 +24,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]);
@@ -32,7 +33,7 @@
const connection = useSelector(connectionSelector(ashoatKeyserverID));
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]);
@@ -44,7 +45,7 @@
}
return getMostRecentNonLocalMessageID(activeThread, state.messageStore);
});
- const prevActiveThreadLatestMessageRef = React.useRef();
+ const prevActiveThreadLatestMessageRef = React.useRef<?string>();
React.useEffect(() => {
prevActiveThreadLatestMessageRef.current = activeThreadLatestMessage;
}, [activeThreadLatestMessage]);
@@ -52,7 +53,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

Mime Type
text/plain
Expires
Sat, Nov 9, 1:39 AM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2447306
Default Alt Text
D9693.diff (6 KB)

Event Timeline