-
Notifications
You must be signed in to change notification settings - Fork 825
fix(desktop): flatten private/DM timelines without stripping reply tags #2593
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
Open
StephGlansberg
wants to merge
6
commits into
block:main
Choose a base branch
from
StephGlansberg:fix/desktop-flatten-private-timelines
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+580
−41
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae835ca
fix(desktop): flatten private/DM timelines without stripping reply tags
StephGlansberg a5d1579
fix(desktop): accept optional threadSummaries in channel timeline helper
StephGlansberg 2166b96
fix(desktop): hydrate complete flattened reply state
StephGlansberg e091836
Merge remote-tracking branch 'origin/main' into fix/desktop-flatten-p…
StephGlansberg 63b13f6
fix(desktop): keep flattened replies within active window
StephGlansberg 4bb5015
fix(desktop): reconcile flattened reply cache on refetch
StephGlansberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { useMemo } from "react"; | ||
| import type { Channel } from "@/shared/api/types"; | ||
| import type { UserProfileLookup } from "@/features/profile/lib/identity"; | ||
| import type { ChannelWindowThreadSummary } from "@/features/messages/lib/channelWindowStore"; | ||
| import { | ||
| buildMainTimelineEntries, | ||
| type MainTimelineEntry, | ||
| } from "@/features/messages/lib/threadPanel"; | ||
| import { shouldFlattenChannelTimeline } from "@/features/messages/lib/threading"; | ||
| import type { TimelineMessage } from "@/features/messages/types"; | ||
|
|
||
| /** Main-timeline entries with private/DM reply flatten applied when appropriate. */ | ||
| export function buildChannelMainTimelineEntries( | ||
| channel: Pick<Channel, "channelType" | "visibility"> | null | undefined, | ||
| messages: TimelineMessage[], | ||
| threadSummaries: ReadonlyMap<string, ChannelWindowThreadSummary> | undefined, | ||
| profiles?: UserProfileLookup, | ||
| ): { entries: MainTimelineEntry[]; flattenReplies: boolean } { | ||
| const flattenReplies = shouldFlattenChannelTimeline(channel); | ||
| return { | ||
| flattenReplies, | ||
| entries: buildMainTimelineEntries( | ||
| messages, | ||
| new Set(), | ||
| threadSummaries ?? new Map(), | ||
| profiles, | ||
| { | ||
| flattenReplies, | ||
| }, | ||
| ), | ||
| }; | ||
| } | ||
|
|
||
| /** Memoized private/DM timeline projection for channel panes. */ | ||
| export function useChannelMainTimelineEntries( | ||
| channel: Pick<Channel, "channelType" | "visibility"> | null | undefined, | ||
| messages: TimelineMessage[], | ||
| threadSummaries: ReadonlyMap<string, ChannelWindowThreadSummary> | undefined, | ||
| profiles?: UserProfileLookup, | ||
| ): { entries: MainTimelineEntry[]; flattenReplies: boolean } { | ||
| return useMemo( | ||
| () => | ||
| buildChannelMainTimelineEntries( | ||
| channel, | ||
| messages, | ||
| threadSummaries, | ||
| profiles, | ||
| ), | ||
| [channel, messages, profiles, threadSummaries], | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a private/DM channel where a new reply lands on an older thread root that is not in the newest top-level window, this only hydrates replies for roots that already have a 39005 summary in the loaded window. I checked the relay window path:
top_levelrows exclude non-broadcast replies and only include depth-null/depth-0/broadcast rows, so the recent reply itself is absent; after a cold load or reconnectreplaceNewestChannelWindowalso clears the live overlay and this code never fetches that root. The visible flattened timeline can therefore drop the newest DM/private messages until the user pages far enough back to load the old root.Useful? React with 👍 / 👎.