fix(desktop): cancel superseded channel reselect

Return huddle navigation promises so deferred navigation can clear its skeleton
when route commits fail, and cover reselecting the current channel while a new
channel is pending.

Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
This commit is contained in:
Wes
2026-08-16 12:19:12 -06:00
parent c6ea385186
commit e17c4df27e
3 changed files with 35 additions and 4 deletions

View File

@@ -2887,6 +2887,32 @@ test("sidebar selection paints before cached channel work starts", async ({
await expect(page.getByTestId("chat-title")).toHaveText("random");
});
test("reselecting the current channel cancels pending sidebar navigation", async ({
page,
}) => {
await page.goto("/");
await page.getByTestId("channel-general").click();
await expect(page.getByTestId("chat-title")).toHaveText("general");
const generalUrl = page.url();
const historyLength = await page.evaluate(() => window.history.length);
await page.evaluate(() => {
document
.querySelector<HTMLElement>('[data-testid="channel-random"]')
?.click();
document
.querySelector<HTMLElement>('[data-testid="channel-general"]')
?.click();
});
await expect(page.getByTestId("pending-channel-skeleton")).toHaveCount(0);
await expect(page.getByTestId("chat-title")).toHaveText("general");
await page.waitForTimeout(100);
await expect(page).toHaveURL(generalUrl);
await expect(page.getByTestId("chat-title")).toHaveText("general");
expect(await page.evaluate(() => window.history.length)).toBe(historyLength);
});
test("superseded sidebar feedback cannot override newer navigation", async ({
page,
}) => {