Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One language call to rule them all #994

Closed
2 tasks
allinox opened this issue Aug 5, 2024 · 0 comments
Closed
2 tasks

One language call to rule them all #994

allinox opened this issue Aug 5, 2024 · 0 comments
Assignees
Labels
kind/chore Create a none user-story issue (chore, tech issue, backend issue) status/draft Status: When you create an issue before you have enough info to properly describe the issue.

Comments

@allinox
Copy link
Contributor

allinox commented Aug 5, 2024

Description

A recent bug in profile (where 1/3 of all calls to it fails) revealed an issue with our current use of profile calls, namely that our BFF make calls to profile to get the user's language every time text with language support is required.
That means fetching every time a search in resources is performed, profile is called; for every search in api; every fetching of service owners for the filter; etc…

Instead of calling profile in three separate occasions on a single page to essentially get the same information, maybe we should instead reuse the language code fetched when the home controller is called. Especially since the change in language cannot be done from our pages at the moment and will not happen that frequently anyway. This will hopefully reduce vulnerability of errors like the current one in profile and also improve performance.

Consideration for language switching: In the future, when we implement an option to change language on our site we need to refetch localized data. Using language as part of the RTK cache key will automatically trigger this refetch.

Suggested solution:

  • Make a global header that sets the user's language using the cookie value i18next (consider changing this name?) so that all calls to BFF contains this information in case it is needed for language support.
  • Go through all BFF controllers and endpoints and make changes to use this new header value for language instead of fetching it from profile.
@allinox allinox added status/draft Status: When you create an issue before you have enough info to properly describe the issue. kind/chore Create a none user-story issue (chore, tech issue, backend issue) labels Aug 5, 2024
@sonwit sonwit self-assigned this Aug 7, 2024
@sonwit sonwit closed this as completed Aug 12, 2024
@github-project-automation github-project-automation bot moved this from 📈 Backlog to ✅ Done in Team Tilgangsstyring & Kontroll Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/chore Create a none user-story issue (chore, tech issue, backend issue) status/draft Status: When you create an issue before you have enough info to properly describe the issue.
Projects
Development

No branches or pull requests

2 participants