Repository navigation
fix(mobile): threads on an unreachable environment no longer hide in the Working shelf #26008
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
saphid
wants to merge
6
commits into
pingdotgg:main
Choose a base branch
from
saphid:fix/mobile-stale-working-disconnected
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.
+122
−13
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bbd678e
fix(mobile): threads on an unreachable environment no longer hide in …
saphid 8c8ed84
Merge commit '961026c6c98118a5017888a8cb6ed7078db140eb' into ready/mo…
saphid a619829
Merge main into fix/mobile-stale-working-disconnected
saphid 2984931
fix(mobile): preserve newline-containing thread list keys
saphid 25774b3
fix(mobile): keep cached threads visible until shell sync
saphid 57c5ad5
fix(mobile): preserve first-connection shelf placement
saphid 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { act, useLayoutEffect } from "react"; | ||
| import { createRoot } from "react-dom/client"; | ||
| import { expect, it } from "vite-plus/test"; | ||
|
|
||
| import { useKeySet } from "./useKeySet"; | ||
|
|
||
| it("preserves embedded newlines without changing identity for reordered keys", async () => { | ||
| const seen: ReadonlySet<string>[] = []; | ||
| function Probe({ keys }: { readonly keys: ReadonlyArray<string> }) { | ||
| const value = useKeySet(keys); | ||
| useLayoutEffect(() => { | ||
| seen.push(value); | ||
| }); | ||
| return null; | ||
| } | ||
| const root = createRoot(document.createElement("div")); | ||
| try { | ||
| await act(async () => root.render(<Probe keys={["a\nb", "c"]} />)); | ||
| expect(seen.at(-1)).toEqual(new Set(["a\nb", "c"])); | ||
| const original = seen.at(-1); | ||
| await act(async () => root.render(<Probe keys={["c", "a\nb"]} />)); | ||
| expect(seen.at(-1)).toBe(original); | ||
| await act(async () => root.render(<Probe keys={["a", "b", "c"]} />)); | ||
| expect(seen.at(-1)).toEqual(new Set(["a", "b", "c"])); | ||
| expect(seen.at(-1)).not.toBe(original); | ||
| await act(async () => root.render(<Probe keys={[]} />)); | ||
| expect(seen.at(-1)?.size).toBe(0); | ||
| } finally { | ||
| act(() => root.unmount()); | ||
| } | ||
| }); |
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,7 @@ | ||
| import { useMemo } from "react"; | ||
|
|
||
| // Stable key sets keep thread row selection handlers stable across list rebuilds. | ||
| export function useKeySet(keys: ReadonlyArray<string>): ReadonlySet<string> { | ||
| const serializedKeys = JSON.stringify([...keys].sort()); | ||
| return useMemo(() => new Set(JSON.parse(serializedKeys) as string[]), [serializedKeys]); | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.