Web: a first-time visitor loses the order link to the walkthrough and lands on Book

Open
#839 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
dart, flutter
Domain
frontend, mobile

Research direction

Start with lib/core/app_routes.dart, especially firstRunRedirect, then read DeepLinkListener and its _waiting handling for how destinations resume after first run. Trace how the web router receives /order_link and preserves its query through the walkthrough and choose-node routes. Done when a first-time web visitor who completes or skips the walkthrough reaches the original OrderLinkScreen with its full query intact; verify against the reproduction steps in the issue.

Written by the indexing model from the issue text.

Description

On the web client, an order link opened by a first-time visitor is lost: the router sends it to the walkthrough and the original destination is never kept, so skipping the walkthrough lands on Book instead of the order.

This is a follow-up to #137, which built the handler. The handler itself works — the link just never reaches it.

Steps to reproduce

  1. Open a browser profile that has never used the web client (or clear its site data for mostro.network).
  2. Visit an order link:
    https://mostro.network/app/#/order_link?link=mostro%3A<order-id>%3Frelays%3D<relays>%26mostro%3D<node-pubkey>
  3. The walkthrough appears.
  4. Complete or skip it.

Expected: OrderLinkScreen for the order in the link, as it does on a second visit.
Actual: Book. The link is gone, with no message; the visitor has no way to recover it short of going back to wherever they found it.

Verified against v2.0.17 in Chrome. On a profile that has already completed the first run, the same URL works end to end: it resolves the order, offers the node switch naming the instance, and reaches the take-order screen.

Why it happens

firstRunRedirect discards the incoming location — lib/core/app_routes.dart#L119-L124:

String? firstRunRedirect({required bool done, required String location}) {
  if (!done) {
    return _firstRunRoutes.contains(location) ? null : AppRoute.walkthrough;
  }
  return location == AppRoute.chooseNode ? AppRoute.home : null;
}

When the first run is not done, any location outside {/walkthrough, /choose-node} returns /walkthrough and location is dropped. Nothing stores it, and /choose-node then returns AppRoute.home.

This hazard is already known and already handled — but only for the path the OS delivers. DeepLinkListener holds such a link until the first run ends (deep_link_listener.dart#L56 and #L100-L103), and its own doc comment states the reason:

A link that arrives during the first run waits for it to end — the router would send the order link screen to the walkthrough and lose it.

On web that listener is deliberately inert, because a page cannot be the handler of a mostro: link (#L76):

static Stream<String> _osLinks() =>
    kIsWeb ? const Stream.empty() : AppLinks().stringLinkStream;

So on web the link enters as a URL straight into the router, which is the one path the existing mitigation does not cover.

Why it matters

The web client is the only https entry point for an order link: the app registers the mostro: scheme (#808) but no https app link, so a link shared in a group chat or on social media can only be opened as https://mostro.network/app/#/order_link?.... Anyone following such a link for the first time is, by definition, a first-time visitor of the web client — exactly the case that fails. A first-time visitor is also the one most worth not losing.

Possible direction

Not a prescription, just the shape that seems consistent with what is already there: keep the destination across the first run and resume it when firstRunProvider turns true, which is what DeepLinkListener already does with _waiting. firstRunRedirect is the natural place to capture it, since it is the function that currently throws it away.

Worth noting that the node-switch prompt the order link screen shows makes this more than a navigation detail: the destination carries which instance published the order, so resuming it has to preserve the query, not just the path.

Dominant language
Dart
Stars
11
Forks
9
Avg merge
2d 1h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MostroP2P/app

All issues in MostroP2P/app

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.