Skip to content

Commit 710447d

Browse files
authored
Merge pull request #934 from objectstack-ai/copilot/fix-ci-test-errors-again
2 parents 1d756f6 + 0e90e6b commit 710447d

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

apps/console/src/__tests__/PluginsIntegration.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ describe('Plugins Integration Test', () => {
7070
}
7171
};
7272

73+
const ONE_DAY_MS = 24 * 60 * 60 * 1000;
7374
const mockData = [
74-
{ id: '1', name: 'Task 1', status: 'new', due_date: '2026-02-15T12:00:00' },
75-
{ id: '2', name: 'Task 2', status: 'working', due_date: '2026-02-16T12:00:00' },
76-
{ id: '3', name: 'Task 3', status: 'done', due_date: '2026-02-17T12:00:00' }
75+
{ id: '1', name: 'Task 1', status: 'new', due_date: new Date(Date.now() + ONE_DAY_MS).toISOString() },
76+
{ id: '2', name: 'Task 2', status: 'working', due_date: new Date(Date.now() + 2 * ONE_DAY_MS).toISOString() },
77+
{ id: '3', name: 'Task 3', status: 'done', due_date: new Date(Date.now() + 3 * ONE_DAY_MS).toISOString() }
7778
];
7879

7980
const mockDataSource = {

apps/console/src/__tests__/ReportViewConfigPanel.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('ReportView — Inline Config Panel', () => {
186186

187187
// Config panel should still be open (not reset)
188188
expect(screen.getByTestId('config-panel-close')).toBeInTheDocument();
189-
// The heading should still show the report title from the viewer
190-
expect(screen.getAllByText('Sales Report').length).toBeGreaterThanOrEqual(1);
189+
// The heading should reflect the live preview title update
190+
expect(screen.getAllByText('Live Preview Title').length).toBeGreaterThanOrEqual(1);
191191
});
192192
});

packages/plugin-calendar/src/ObjectCalendar.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* - Works with object/api/value data providers
2323
*/
2424

25-
import React, { useEffect, useState, useCallback, useMemo } from 'react';
25+
import React, { useEffect, useState, useCallback, useMemo, useRef } from 'react';
2626
import type { ObjectGridSchema, DataSource, ViewData, CalendarConfig } from '@object-ui/types';
2727
import { CalendarView, type CalendarEvent } from './CalendarView';
2828
import { usePullToRefresh } from '@object-ui/mobile';
@@ -183,6 +183,10 @@ export const ObjectCalendar: React.FC<ObjectCalendarProps> = ({
183183
]);
184184
const hasInlineData = dataConfig?.provider === 'value';
185185

186+
// Use ref for objectSchema to avoid double-fetch on mount
187+
const objectSchemaRef = useRef<any>(null);
188+
objectSchemaRef.current = objectSchema;
189+
186190
// Fetch data based on provider
187191
useEffect(() => {
188192
let isMounted = true;
@@ -216,7 +220,7 @@ export const ObjectCalendar: React.FC<ObjectCalendarProps> = ({
216220
if (dataConfig?.provider === 'object') {
217221
const objectName = dataConfig.object;
218222
// Auto-inject $expand for lookup/master_detail fields
219-
const expand = buildExpandFields(objectSchema?.fields);
223+
const expand = buildExpandFields(objectSchemaRef.current?.fields);
220224
const result = await dataSource.find(objectName, {
221225
$filter: schema.filter,
222226
$orderby: convertSortToQueryParams(schema.sort),
@@ -245,7 +249,7 @@ export const ObjectCalendar: React.FC<ObjectCalendarProps> = ({
245249

246250
fetchData();
247251
return () => { isMounted = false; };
248-
}, [dataConfig, dataSource, hasInlineData, schema.filter, schema.sort, refreshKey, objectSchema]);
252+
}, [dataConfig, dataSource, hasInlineData, schema.filter, schema.sort, refreshKey]);
249253

250254
// Fetch object schema for field metadata
251255
useEffect(() => {

0 commit comments

Comments
 (0)