Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ import * as React from 'react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { PackageFormDialog } from './PackageFormDialog';
// The form's field labels (`engine.packages.create.*`) live in `@object-ui/i18n`'s
// `studio` namespace, whose `zh` catalogue is fetched on demand. Resident before
// any case, so `getByLabelText(/软件包 ID/)` reads the zh label, never the en
// fallback while the chunk is in flight (objectstack#26863).
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
await loadStudioCatalogue('zh');

let localeFixture: 'en-US' | 'zh-CN' = 'zh-CN';
vi.mock('./i18n', async (importOriginal) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ import { MetadataResourceEditPage } from './ResourceEditPage';
import { registerDefaultMetadataSchemas } from './default-schemas';
import { registerBuiltinPreviews } from './previews';
import { tFormat } from './i18n';
// The `engine.edit.*` rows this suite reads in zh (the `丢弃草稿` button, the
// confirm and the toast) live in `@object-ui/i18n`'s `studio` namespace, whose
// `zh` catalogue is fetched on demand. Resident before any case, so the zh rows
// are read after the catalogue lands, never racing it (objectstack#26863).
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
await loadStudioCatalogue('zh');

const DOC_JSON_SCHEMA = z.toJSONSchema(DocSchema as unknown as z.ZodType) as Record<string, unknown>;
client.current = new MetadataClient({ baseUrl: '', fetch: vi.fn(serve) as unknown as typeof fetch });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ vi.mock('./i18n', async (importOriginal) => ({
}));

import { MetadataResourceEditPage } from './ResourceEditPage';
// The read-only banner (`engine.edit.readOnlyTypeBanner`) lives in
// `@object-ui/i18n`'s `studio` namespace, whose `zh` catalogue is fetched on
// demand. Resident before any case, so the zh banner is read after the
// catalogue lands, never racing it (objectstack#26863).
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
await loadStudioCatalogue('zh');

/** An item a code package ships, as the layered read serves it. */
function packagedItem() {
Expand Down
Loading