From 0e90630f2504e90ca2e040975cabab6040e6957e Mon Sep 17 00:00:00 2001 From: Grant Fitzsimmons <37256050+grantfitzsimmons@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:19:40 -0500 Subject: [PATCH 1/3] fix(preferences): fetch language independently --- .../js_src/lib/components/DataModel/tables.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts b/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts index 32d4bfbafb4..284b814ac90 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts @@ -61,11 +61,17 @@ const processFields = ( let schemaLocalization: IR = undefined!; const fetchSchemaLocalization = f.store(async () => import('../Preferences/userPreferences').then(async ({ userPreferences }) => - load>( - formatUrl('/context/schema_localization.json', { - lang: userPreferences.get('form', 'schema', 'language'), - }), - 'application/json' + // Preferences are fetched independently of the initial context. Reading + // the schema language before that fetch completes can request the default + // language, and f.store() would then keep that localization for the life + // of the page. + userPreferences.fetch().then(() => + load>( + formatUrl('/context/schema_localization.json', { + lang: userPreferences.get('form', 'schema', 'language'), + }), + 'application/json' + ) ) ) ); From f04fe1d13de851de6e0c4eedc9fd260293c1d1c4 Mon Sep 17 00:00:00 2001 From: Grant Fitzsimmons <37256050+grantfitzsimmons@users.noreply.github.com> Date: Wed, 7 Oct 2026 10:17:37 -0500 Subject: [PATCH 2/3] fix(preferences): fetching --- .../js_src/lib/components/DataModel/tables.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts b/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts index 284b814ac90..1c85b563a2d 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/tables.ts @@ -65,14 +65,17 @@ const fetchSchemaLocalization = f.store(async () => // the schema language before that fetch completes can request the default // language, and f.store() would then keep that localization for the life // of the page. - userPreferences.fetch().then(() => - load>( - formatUrl('/context/schema_localization.json', { - lang: userPreferences.get('form', 'schema', 'language'), - }), - 'application/json' + userPreferences + .fetch() + .catch(() => undefined) + .then(() => + load>( + formatUrl('/context/schema_localization.json', { + lang: userPreferences.get('form', 'schema', 'language'), + }), + 'application/json' + ) ) - ) ) ); export const getSchemaLocalization = (): IR => From 09d1291da046b97cd5ec457e8bd39005c7979461 Mon Sep 17 00:00:00 2001 From: Grant Fitzsimmons <37256050+grantfitzsimmons@users.noreply.github.com> Date: Wed, 7 Oct 2026 18:08:56 +0000 Subject: [PATCH 3/3] Lint code with ESLint and Prettier Triggered by 3a58e32880e60fc370f2602be6487637f32a2ccb on branch refs/heads/issue-8638 --- .../lib/components/SchemaConfig/Layout.tsx | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/SchemaConfig/Layout.tsx b/specifyweb/frontend/js_src/lib/components/SchemaConfig/Layout.tsx index ac53a147a8d..fd7b08024c5 100644 --- a/specifyweb/frontend/js_src/lib/components/SchemaConfig/Layout.tsx +++ b/specifyweb/frontend/js_src/lib/components/SchemaConfig/Layout.tsx @@ -24,7 +24,7 @@ import { useSchemaConfig, } from './Store'; import { dialogIcons } from '../Atoms/Icons'; -import { raise } from '../Errors/Crash'; +import { raise } from '../Errors/Crash'; export function SchemaConfigLayout(): JSX.Element { const schemaData = useOutletContext(); @@ -94,20 +94,30 @@ function SchemaConfigLayoutContent(): JSX.Element { method: 'POST', headers: { Accept: 'application/json' }, body: { schema, language: rawLanguage }, - expectedErrors: [400, 500, 504] + expectedErrors: [400, 500, 504], }) ) .then( (response) => { - setImportStatus(response.status); - if (response.status !== 200) - raise({name: schemaText.importSchemaError({schemaConfig: schemaText.schemaConfig()}), message: - response.status === 504 ? schemaText.importSchemaErrorTimeout({schemaConfig: schemaText.schemaConfig()}) : - response.status === 400 ? schemaText.importSchemaErrorBadRequest({schemaConfig: schemaText.schemaConfig()}) : - schemaText.importSchemaErrorInternalError() - }) - }, - (err) => raise(err) + setImportStatus(response.status); + if (response.status !== 200) + raise({ + name: schemaText.importSchemaError({ + schemaConfig: schemaText.schemaConfig(), + }), + message: + response.status === 504 + ? schemaText.importSchemaErrorTimeout({ + schemaConfig: schemaText.schemaConfig(), + }) + : response.status === 400 + ? schemaText.importSchemaErrorBadRequest({ + schemaConfig: schemaText.schemaConfig(), + }) + : schemaText.importSchemaErrorInternalError(), + }); + }, + (err) => raise(err) ) ); };