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) {