-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(desktop): show thread replies inline #7036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4a5d8b8
5d09a9b
e73064c
5115275
782384f
c75ca0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,13 +161,45 @@ export function useChannelPaneHandlers({ | |
| }, []); | ||
|
|
||
| const handleEdit = React.useCallback( | ||
| (message: { id: string }) => { | ||
| (message: { id: string; rootId?: string | null }) => { | ||
| const threadHeadId = message.rootId ?? null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the user edits a broadcast reply, Useful? React with 👍 / 👎. |
||
| if ( | ||
| threadHeadId && | ||
| openThreadHeadIdRef.current !== threadHeadId && | ||
| !requireThreadEditResolution() | ||
| ) | ||
| return; | ||
| if (threadHeadId && openThreadHeadIdRef.current !== threadHeadId) { | ||
| deferPanelState(() => { | ||
| setExpandedThreadReplyIds(new Set()); | ||
| onOptimisticOpenThreadHeadIdChange(threadHeadId); | ||
| setOpenThreadHeadId(threadHeadId); | ||
| // Navigation can commit before local target state. Set the child | ||
| // target after the containing thread panel has mounted. | ||
| deferPanelState(() => { | ||
| setEditTargetId(message.id); | ||
| setThreadReplyTargetId(threadHeadId); | ||
| setThreadScrollTargetId(message.id); | ||
| }); | ||
| }); | ||
| return; | ||
| } | ||
| setEditTargetId((current) => | ||
| current === message.id ? null : message.id, | ||
| ); | ||
| setThreadReplyTargetId(openThreadHeadIdRef.current); | ||
| setThreadReplyTargetId(threadHeadId ?? openThreadHeadIdRef.current); | ||
| if (threadHeadId) setThreadScrollTargetId(message.id); | ||
| }, | ||
| [setEditTargetId, setThreadReplyTargetId], | ||
| [ | ||
| deferPanelState, | ||
| onOptimisticOpenThreadHeadIdChange, | ||
| requireThreadEditResolution, | ||
| setEditTargetId, | ||
| setExpandedThreadReplyIds, | ||
| setOpenThreadHeadId, | ||
| setThreadReplyTargetId, | ||
| setThreadScrollTargetId, | ||
| ], | ||
| ); | ||
|
|
||
| const handleEditSave = React.useCallback( | ||
|
|
@@ -214,9 +246,17 @@ export function useChannelPaneHandlers({ | |
| ); | ||
|
|
||
| const handleOpenThread = React.useCallback( | ||
| (message: { id: string }) => { | ||
| (message: { id: string; rootId?: string | null }) => { | ||
| if (!requireThreadEditResolution()) return; | ||
| if (openThreadHeadIdRef.current === message.id) { | ||
| const threadHeadId = message.rootId ?? message.id; | ||
| const replyTargetId = message.rootId ? message.id : threadHeadId; | ||
| if (openThreadHeadIdRef.current === threadHeadId) { | ||
| if (message.rootId) { | ||
| setThreadReplyTargetId(replyTargetId); | ||
| setThreadScrollTargetId(replyTargetId); | ||
| setEditTargetId(null); | ||
| return; | ||
| } | ||
| deferPanelState(() => { | ||
| onOptimisticOpenThreadHeadIdChange(null); | ||
| setOpenThreadHeadId(null); | ||
|
|
@@ -229,11 +269,17 @@ export function useChannelPaneHandlers({ | |
| } | ||
|
|
||
| deferPanelState(() => { | ||
| onOptimisticOpenThreadHeadIdChange(message.id); | ||
| setOpenThreadHeadId(message.id); | ||
| setThreadReplyTargetId(message.id); | ||
| setThreadScrollTargetId(null); | ||
| setExpandedThreadReplyIds(new Set()); | ||
| onOptimisticOpenThreadHeadIdChange(threadHeadId); | ||
| setOpenThreadHeadId(threadHeadId); | ||
| if (message.rootId) { | ||
| // Navigation can commit before local target state. Set the child | ||
| // target after the containing thread panel has mounted. | ||
| deferPanelState(() => { | ||
| setThreadReplyTargetId(replyTargetId); | ||
| setThreadScrollTargetId(replyTargetId); | ||
| }); | ||
| } | ||
| }); | ||
| setEditTargetId(null); | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.