Skip to content

Commit

Permalink
only go back after send if it's a chat
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Jul 1, 2024
1 parent 3bcb3f6 commit 5bcfb55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions e2e/roundtrip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@ test("rountrip receive and send", async ({ page }) => {
// Wait for an h1 to appear in the dom that says "Payment Sent"
await page.waitForSelector("text=Payment Sent", { timeout: 30000 });

// Click the "Nice" button
// Click the "Nice" button to go home
await page.click("text=Nice");

// Go home
await page.click("text=Home");

// Click settings
await visitSettings(page);

Expand Down
7 changes: 6 additions & 1 deletion src/routes/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,12 @@ export function Send() {
onConfirm={() => {
setSentDetails(undefined);
const state = location.state as { previous?: string };
if (state?.previous) {
// If we're coming from a chat, we want to go back to the chat
// Otherwise we want to go home
if (
state?.previous &&
state?.previous.includes("chat/")
) {
navigate(state?.previous);
} else {
navigate("/");
Expand Down

0 comments on commit 5bcfb55

Please sign in to comment.