Skip to content

Commit dfb35fb

Browse files
authored
Merge pull request #1104 from objectstack-ai/copilot/fix-action-step-issue-another-one
2 parents da3a0f1 + 4475d6e commit dfb35fb

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515

16+
- **CI Build Fix: Replace dynamic `require()` with static imports** (`@object-ui/plugin-view`): Replaced module-level `require('@object-ui/react')` calls in `index.tsx` and `ObjectView.tsx` with static `import` statements. The dynamic `require()` pattern is not supported by Next.js Turbopack, causing the docs site build to fail during SSR prerendering of the `/docs/components/complex/view-switcher` page with `Error: dynamic usage of require is not supported`. Since `@object-ui/react` is already a declared dependency and other files in the package use static imports from it, replacing the `require()` with static imports is safe and eliminates the SSR compatibility issue.
17+
18+
- **CI Build Fix: Remove unused `...rest` parameter** (`@object-ui/plugin-calendar`): Removed unused `...rest` destructured parameter from `ObjectCalendar` component props (TS6133), which caused the declaration file generation to emit a TypeScript error during the build.
19+
1620
- **CI Build Fix: Unused Parameters in Test Mocks** (`apps/console`): Fixed TypeScript `noUnusedParameters` errors (TS6133) in `ListToolbarActions.test.tsx` where mock component `props` parameters were declared but never used in `@object-ui/plugin-kanban` and `@object-ui/plugin-calendar` mocks, causing the console `tsc` build step to fail in CI.
1721

1822
- **i18n loadLanguage Not Compatible with Spec REST API Response Format** (`apps/console`): Fixed `loadLanguage` in `apps/console/src/main.tsx` to correctly unwrap the `@objectstack/spec` REST API envelope `{ data: { locale, translations } }`. Previously, the function returned the raw JSON response, which meant `useObjectLabel` and `useObjectTranslation` hooks received a wrapped object instead of the flat translation map, causing business object and field labels (e.g., CRM contact/account) to fall back to English. The fix extracts `data.translations` when the spec envelope is detected, while preserving backward compatibility with mock/dev environments that return flat translation objects. Includes 6 unit tests covering spec envelope unwrapping, flat fallback, HTTP errors, network failures, and edge cases.

packages/plugin-calendar/src/ObjectCalendar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export const ObjectCalendar: React.FC<ObjectCalendarProps> = ({
155155
onViewChange,
156156
onEventDrop,
157157
locale,
158-
...rest
159158
}) => {
160159
// When the parent (e.g. ObjectView) pre-fetches data and passes it via the `data` prop,
161160
// we must not trigger a second fetch. Detect external data by checking for an array.

packages/plugin-view/src/ObjectView.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,13 @@ import {
5757
} from '@object-ui/components';
5858
import { Plus } from 'lucide-react';
5959
import { buildExpandFields } from '@object-ui/core';
60+
import { SchemaRenderer as ImportedSchemaRenderer } from '@object-ui/react';
6061
import { ViewSwitcher } from './ViewSwitcher';
6162

6263
/**
63-
* Attempt to import SchemaRenderer from @object-ui/react.
64-
* Falls back to null if not available.
64+
* SchemaRenderer from @object-ui/react, used to render sub-view schemas.
6565
*/
66-
let SchemaRendererComponent: React.FC<any> | null = null;
67-
try {
68-
// eslint-disable-next-line @typescript-eslint/no-require-imports
69-
const mod = require('@object-ui/react');
70-
SchemaRendererComponent = mod.SchemaRenderer || null;
71-
} catch {
72-
// @object-ui/react not available
73-
}
66+
const SchemaRendererComponent: React.FC<any> = ImportedSchemaRenderer;
7467

7568
export interface ObjectViewProps {
7669
/**

packages/plugin-view/src/index.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import React, { useContext } from 'react';
1010
import { ComponentRegistry } from '@object-ui/core';
11+
import { SchemaRendererContext as ImportedSchemaRendererContext } from '@object-ui/react';
1112
import { ObjectView } from './ObjectView';
1213
import { ViewSwitcher } from './ViewSwitcher';
1314
import { FilterUI } from './FilterUI';
@@ -25,22 +26,9 @@ export type { SharedViewLinkProps } from './SharedViewLink';
2526

2627
/**
2728
* SchemaRendererContext is created by @object-ui/react.
28-
* We import it dynamically to avoid a circular dependency.
2929
* The context value provides { dataSource }.
30-
* A fallback context is created so hooks are never called conditionally.
3130
*/
32-
const FallbackContext = React.createContext<any>(null);
33-
let SchemaRendererContext: React.Context<any> = FallbackContext;
34-
try {
35-
// eslint-disable-next-line @typescript-eslint/no-require-imports
36-
const mod = require('@object-ui/react');
37-
// The context is re-exported from @object-ui/react
38-
if (mod.SchemaRendererContext) {
39-
SchemaRendererContext = mod.SchemaRendererContext;
40-
}
41-
} catch {
42-
// @object-ui/react not available — registry-based dataSource only
43-
}
31+
const SchemaRendererContext: React.Context<any> = ImportedSchemaRendererContext;
4432

4533
// Register object-view component
4634
const ObjectViewRenderer: React.FC<{ schema: any }> = ({ schema }) => {

0 commit comments

Comments
 (0)