From ae616da565901a0d3d5ba5c2812ed3ebaf42e717 Mon Sep 17 00:00:00 2001 From: Beef Date: Tue, 18 Oct 2022 23:14:01 +0100 Subject: [PATCH] [Metro] Get language on search instead --- src/lib/metro/filters.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/metro/filters.ts b/src/lib/metro/filters.ts index 3611dd6..424cc38 100644 --- a/src/lib/metro/filters.ts +++ b/src/lib/metro/filters.ts @@ -27,13 +27,13 @@ for (const key in window.modules) { } } -// Get the previous moment locale -const previousLocale = moment?.locale(); - // Function to filter through modules export const filterModules = (modules: MetroModules, single = false) => (filter: (m: any) => boolean) => { const found = []; + // Get the previous moment locale + const previousLocale = moment?.locale(); + for (const key in modules) { const id = Number(key); const module = modules[id].publicModule.exports; @@ -41,7 +41,7 @@ export const filterModules = (modules: MetroModules, single = false) => (filter: if (!modules[id].isInitialized) try { __r(id); // Set moment locale, sort of crappy fix but works I guess - if (previousLocale) moment.locale(previousLocale); + if (previousLocale && previousLocale !== moment.locale()) moment.locale(previousLocale); } catch {}; if (!module) {