quran / quran.com-frontend-next

Frontend build on next.js
https://quran.com
1.37k stars 399 forks source link

[bug]: Selected language is not persisting when revisiting quran.com #2104

Open 3rg1s opened 7 months ago

3rg1s commented 7 months ago

Is there an existing issue for this?

Describe the bug

Setting a language perviously would cause the web app to keep the setting and have that language, as it takes the value from the NEXT_LOCALE cookie. The issue is only visible on prod and on beta environments. Also the NEXT_LOCALE cookie is set all the times.

Relevant log output

No response

Steps to reproduce

  1. Visit quran.com
  2. Click the globe icon and choose a language
  3. Close the tab and reopen quran.com

Environment (please complete the following information) and Add any other context about this bug

Tested on Macbook pro:

  1. Safari -> Version 17.3.1 (19617.2.4.11.12)
  2. Chrome -> Version 122.0.6261.94 (Official Build) (arm64)
  3. Brave -> Version 1.63.165 Chromium: 122.0.6261.94 (Official Build) (arm64) -- Based on chrome
  4. Firefox -> Version 123.0.1 (64-bit)

Environment

Production(quran.com)

fajicbenjamin commented 7 months ago

Weird, I experience same on production site, but no issue when run it locally! Is it same for you?

Also, was wondering, is prefixing default locale maybe nice to have generally? From what I can see NEXT_LOCALE cookie works only when app is opened on /, so for example even with the cookie, if you open not prefixed URL on some surah or any other page, you won't get language from cookie?

3rg1s commented 7 months ago

Weird, I experience same on production site, but no issue when run it locally! Is it same for you?

Also, was wondering, is prefixing default locale maybe nice to have generally? From what I can see NEXT_LOCALE cookie works only when app is opened on /, so for example even with the cookie, if you open not prefixed URL on some surah or any other page, you won't get language from cookie?

Yes it does work locally for me. Well If i set a language and then goto /login, it wont change the language to the one I have set, so indeed it does set it when opening /