Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3357853
D6053.id20627.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
D6053.id20627.diff
View Options
diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js
--- a/web/chat/chat-input-bar.react.js
+++ b/web/chat/chat-input-bar.react.js
@@ -588,17 +588,35 @@
[typeaheadRegexMatches],
);
+ React.useEffect(() => {
+ if (props.inputState.typeaheadState.keepUpdatingThreadMembers) {
+ const setter = props.inputState.setTypeaheadState;
+ setter({
+ frozenThreadMembers: threadMembers,
+ });
+ }
+ }, [
+ threadMembers,
+ props.inputState.setTypeaheadState,
+ props.inputState.typeaheadState.keepUpdatingThreadMembers,
+ ]);
+
const suggestedUsers: $ReadOnlyArray<RelativeMemberInfo> = React.useMemo(() => {
if (!typeaheadMatchedStrings) {
return [];
}
return getTypeaheadUserSuggestions(
userSearchIndex,
- threadMembers,
+ props.inputState.typeaheadState.frozenThreadMembers,
viewerID,
typeaheadMatchedStrings.usernamePrefix,
);
- }, [userSearchIndex, threadMembers, viewerID, typeaheadMatchedStrings]);
+ }, [
+ userSearchIndex,
+ props.inputState.typeaheadState.frozenThreadMembers,
+ viewerID,
+ typeaheadMatchedStrings,
+ ]);
return (
<ChatInputBar
diff --git a/web/chat/typeahead-tooltip.react.js b/web/chat/typeahead-tooltip.react.js
--- a/web/chat/typeahead-tooltip.react.js
+++ b/web/chat/typeahead-tooltip.react.js
@@ -45,9 +45,18 @@
React.useEffect(() => {
setIsVisibleForAnimation(true);
+ const setter = inputState.setTypeaheadState;
+ setter({
+ keepUpdatingThreadMembers: false,
+ });
- return () => setIsVisibleForAnimation(false);
- }, []);
+ return () => {
+ setter({
+ keepUpdatingThreadMembers: true,
+ });
+ setIsVisibleForAnimation(false);
+ };
+ }, [inputState.setTypeaheadState]);
const actions = React.useMemo(
() =>
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
@@ -144,6 +144,8 @@
textCursorPositions: {},
typeaheadState: {
canBeVisible: false,
+ keepUpdatingThreadMembers: true,
+ frozenThreadMembers: [],
moveChoiceUp: null,
moveChoiceDown: null,
close: null,
diff --git a/web/input/input-state.js b/web/input/input-state.js
--- a/web/input/input-state.js
+++ b/web/input/input-state.js
@@ -8,7 +8,7 @@
type MediaMissionStep,
} from 'lib/types/media-types';
import type { RawTextMessageInfo } from 'lib/types/messages/text';
-import type { ThreadInfo } from 'lib/types/thread-types';
+import type { ThreadInfo, RelativeMemberInfo } from 'lib/types/thread-types';
export type PendingMultimediaUpload = {
localID: string,
@@ -36,6 +36,8 @@
export type TypeaheadState = {
+canBeVisible: boolean,
+ +keepUpdatingThreadMembers: boolean,
+ +frozenThreadMembers: $ReadOnlyArray<RelativeMemberInfo>,
+moveChoiceUp: ?() => void,
+moveChoiceDown: ?() => void,
+close: ?() => void,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 1:58 AM (16 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577983
Default Alt Text
D6053.id20627.diff (3 KB)
Attached To
Mode
D6053: [web] Keyboard support for typeahead [13/13] - Freeze users list when typeahead is visible.
Attached
Detach File
Event Timeline
Log In to Comment