Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.

Bug with French toggling not in prod #437

Open
katewilhelm opened this issue May 14, 2020 · 4 comments
Open

Bug with French toggling not in prod #437

katewilhelm opened this issue May 14, 2020 · 4 comments

Comments

@katewilhelm
Copy link

When I was testing a deployment for another PR, I found the re-emergence of a previously fixed bug. Something weird is happening with toggling to French and then going back to English and later it remembering the previous French request. Here's what I did:

  1. Get to results page in English.
  2. Toggle to French results.
  3. Use browser back button to go back to English results.
  4. Click start over

Here's what happened:
Start page appears in French.

I tried this in prod and there was no problem.

@katedee
Copy link
Contributor

katedee commented May 14, 2020

For the record, I was able to reproduce this locally on master as well, so it seems to not be specific to my PR. Will keep looking into it though, just wanted to check that I wasn't letting a bug thru 🤞

@dsamojlenko
Copy link
Member

It's because the route we use for the Start Over link that clears the session data is a unilingual link: /clear.

When you use the browser back button, it doesn't actually change your language back, it just renders the previous page from cache. So when you hit /clear and get redirected to /, your session language is still French.

Should be an easy fix - just create multiple clear routes (in the global controller). I'd leave the existing one, but add /en/clear and /fr/clear ... they would all have the same action (set session to null, redirect to /)

Then again, now that I think of it, maybe even easier - the Start route also clears the session. Rather than having the Start Over link use the /clear route, you could just use the named start route.

@courtneycl
Copy link

Something that IS happening on prod:

  1. Start now
  2. Answer a few questions to get a far down paths
  3. Switch language to French
  4. Click retour
  5. Observe the same page switch languages to English. Expected we would see the previous question in French.

Is this a separate bug?

@dsamojlenko
Copy link
Member

oh yeah, so because our Back button is just hooking into the browser's history stack, this is similarly expected behaviour - it's like if you're on any page, hit the Français link, then hit browser back, you'll be looking at an English page, because that's the last thing in your history. Our back link works the exact same way.

hmmm... we've got a longstanding item to revisit how the back link works. I'm not sure what the solution will be. We hooked into the browser history stack because it's the easiest implementation - the browser always knows where you came from.

The challenge in implementing a back button in our case, is we're not always sure where the user came from - could be different depending on answers to previous questions... but it's something we do want to figure out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants