From b8919a4775f43d4f34b3483a174eda1267bc075b Mon Sep 17 00:00:00 2001 From: siddharthd Date: Tue, 28 Jul 2026 15:34:24 +1000 Subject: [PATCH] feat(transactions): honour ?q= so a link can land on one row The Slack order nudge links here. Without it the link drops you at the top of an unfiltered ledger and the merchant has to be found by hand, which is how a nudge stops being opened. --- src/app/transactions/page.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/transactions/page.tsx b/src/app/transactions/page.tsx index b5c784b..cf1c2f1 100644 --- a/src/app/transactions/page.tsx +++ b/src/app/transactions/page.tsx @@ -507,6 +507,13 @@ function TransactionsContent() { const searchParams = useSearchParams(); const initialStatementId = searchParams.get("statement_id") || ""; + // `?q=` lands the view on a specific row. The Slack order nudge links here, + // and without it the link drops you at the top of an unfiltered ledger and + // the merchant has to be found by hand — which is how a nudge stops getting + // opened. + const initialQuery = searchParams.get("q") || ""; + const initialParsed = parseQuery(initialQuery); + const [filters, setFilters] = useState({ from: "", to: "", @@ -514,7 +521,7 @@ function TransactionsContent() { bank_names: [] as string[], tag_ids: [] as string[], transaction_types: [] as string[], - search: "", + search: initialParsed.text, statement_id: initialStatementId, sort_by: "transaction_date", sort_dir: "desc", @@ -525,8 +532,8 @@ function TransactionsContent() { has_split: "" as string, trip_id: "" as string, }); - const [queryInput, setQueryInput] = useState(""); - const [queryTokens, setQueryTokens] = useState([]); + const [queryInput, setQueryInput] = useState(initialQuery); + const [queryTokens, setQueryTokens] = useState(initialParsed.tokens); function handleQueryChange(val: string) { setQueryInput(val);