Files
Fleetbase-Mirror-Repo/console/app/initializers/load-runtime-config.js
roncodes fd569cfeaf fix: ensure intl polyfills load before runtime config
- Added name to load-intl-polyfills initializer
- Made load-runtime-config run after load-intl-polyfills
- Fixes race condition where intl service initialized before polyfill data loaded
- Resolves MISSING_DATA errors for all locales (mn-mn, etc.)

Initialization order now:
1. load-intl-polyfills (loads formatjs polyfill data)
2. load-runtime-config (loads fleetbase.config.json)
3. load-socketcluster-client
4. Other initializers
2025-11-28 04:52:07 -05:00

42 lines
1.4 KiB
JavaScript

import loadRuntimeConfig from '@fleetbase/console/utils/runtime-config';
import { debug } from '@ember/debug';
/**
* Load Runtime Config Initializer
*
* Loads runtime configuration from fleetbase.config.json before the application boots.
* This must run first to ensure all config is available for other initializers.
*
* Uses `before` to ensure it runs before any other initializers.
*
* @export
* @param {Application} application
*/
export function initialize(application) {
const startTime = performance.now();
debug('[Initializer:load-runtime-config] Loading runtime configuration...');
// Defer readiness until config is loaded
application.deferReadiness();
loadRuntimeConfig()
.then(() => {
const endTime = performance.now();
debug(`[Initializer:load-runtime-config] Runtime config loaded in ${(endTime - startTime).toFixed(2)}ms`);
application.advanceReadiness();
})
.catch((error) => {
console.error('[Initializer:load-runtime-config] Failed to load runtime config:', error);
// Still advance readiness to prevent hanging
application.advanceReadiness();
});
}
export default {
name: 'load-runtime-config',
initialize,
// Run after intl polyfills are loaded, before socketcluster
after: 'load-intl-polyfills',
before: 'load-socketcluster-client'
};