Skip to content

Commit

Permalink
fix: remove the possbility of memory leak and performance penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Jun 9, 2020
1 parent d2aae4a commit d01d89a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/runtime/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,9 @@ export function getLanguageFromRequest(
return defaultLanguage;
}

// Copy the array so that it won't be mutated
appLanguages = [...appLanguages];

appLanguages.unshift(defaultLanguage);
acceptLanguage.languages(appLanguages);
const bestLanguage = acceptLanguage.get(reqLanguage);
Expand Down

0 comments on commit d01d89a

Please sign in to comment.