Back to Feed
article 3m read

A setup-wizard redirect that moved four times in one evening

The first-run wizard check went from the root layout to the sign-in callback to a flag on the login profile, and only stopped misrouting people once the landing page and the wizard page asked the same rule about the same database row.

Article DepthPractice

Flow

Where the setup check lived, and what it did

Four tries in one evening.

  1. 1Root layout

    Wraps the wizard page too and can't see the path, so it likely redirects a new person to the page they're on.

  2. 2After login

    A failed lookup fell back to the dashboards, so a new person could skip setup until the next login.

  3. 3Profile flag

    Per person, string-typed and only written on finish, so invited teammates likely bounced through the wizard.

  4. 4Shared rule

    Landing page and wizard page ask the same rule about the same row. No workspace shows a message instead.

Seeing a setup wizard once, and then never again, was what I wanted for a new person after sign-in. In one evening I moved the code that sends them there four times. Three of those spots were wrong.

The rule itself never changed. You get the wizard if you're an active member of this workspace, you haven't finished setup here, and you're the only active member. People invited into a team that already has members never get it. The "finished" mark sits on your membership, not on you.

Four spots, four problems

The wizard used to be a pop-up the root layout drew over every page. I gave it a page of its own and then had to decide who sends people there.

The layout. I added a redirect in the root layout. But that layout wraps every page, the wizard included, and it can't tell which page it's on. I'm fairly sure that sends a new person on the wizard back to the wizard, again and again. I have the code, not a report of it. It was out within the hour.

The sign-in step. Next, the code that runs right after login picked the wizard or the dashboards. If the lookup broke, it fell back to the dashboards. So a database hiccup at login meant a new person skipped setup, and nothing asked again until the next login.

A flag on the profile. Then the landing page checked a flag stored on the person's profile at my login provider. My guess is the draw was skipping a database query. But now one fact lived in two places that didn't match. The flag was per person; the real record was per membership. It was a string. It was only written when someone finished, so invited teammates never had it. As far as I can tell, they got sent to the wizard and then bounced on to the dashboards every time.

One rule at both ends. The version I kept drops the flag. The landing page and the wizard page ask the same rule about the same database row. The wizard page sends anyone it won't prompt back to the landing page. That shouldn't loop, because both pages get the same answer. With no workspace, the landing page shows a message instead of redirecting.

Where the check doesn't reach

Two gaps are left. The check only runs on the landing page, so a deep link into a dashboard skips the wizard. And none of the day's tests run the landing page and the wizard page together.

One case I haven't tried is a person in two workspaces. Since the mark sits on the membership, it should work. I'd still like to watch it happen.

Keep reading

Pick up a connected idea or branch into a nearby one.

5 paths forward