feat(transactions): honour ?q= so a link can land on one row
ci / lint-test (push) Successful in 42s

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.
This commit is contained in:
2026-07-28 15:34:24 +10:00
parent 0cb46a087b
commit b8919a4775
+10 -3
View File
@@ -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<QueryToken[]>([]);
const [queryInput, setQueryInput] = useState(initialQuery);
const [queryTokens, setQueryTokens] = useState<QueryToken[]>(initialParsed.tokens);
function handleQueryChange(val: string) {
setQueryInput(val);