Skip to content

Commit 3486b9d

Browse files
Copilothotlong
andcommitted
fix: prevent duplicate data in calendar and kanban views
- Skip PluginObjectView data fetch when renderListView handles its own data, eliminating wasteful parallel fetches and re-renders that cause duplicate records - Add results.value (OData format) handling to ListView data extraction Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/c52a20c8-22a2-4511-85ed-d8bc9fd98fdc
1 parent ccd7aa3 commit 3486b9d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/plugin-list/src/ListView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ export const ListView: React.FC<ListViewProps> = ({
661661
items = (results as any).data;
662662
} else if (Array.isArray((results as any).records)) {
663663
items = (results as any).records;
664+
} else if (Array.isArray((results as any).value)) {
665+
items = (results as any).value;
664666
}
665667
}
666668

packages/plugin-view/src/ObjectView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,12 @@ export const ObjectView: React.FC<ObjectViewProps> = ({
292292
let isMounted = true;
293293

294294
const fetchData = async () => {
295+
// When renderListView is provided, the custom list view (e.g. ListView)
296+
// handles its own data fetching — skip to avoid duplicate requests and
297+
// unnecessary re-renders that can cause duplicate records in child views.
298+
if (renderListView) return;
295299
// Only fetch for non-grid views (ObjectGrid has its own data fetching)
296-
if (currentViewType === 'grid' && !renderListView) return;
300+
if (currentViewType === 'grid') return;
297301
if (!dataSource || !schema.objectName) return;
298302

299303
setLoading(true);

0 commit comments

Comments
 (0)