Skip to content

Commit 3032f98

Browse files
committed
Enhance data handling in ObjectMap; prioritize props.data over schema.data and allow additional props in ObjectMapRenderer
1 parent 471a5af commit 3032f98

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/plugin-map/src/ObjectMap.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,18 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
240240
setLoading(true);
241241

242242
// Prioritize data passed via props (from ListView)
243-
if ((schema as any).data || (rest as any).data) {
244-
const passed = (schema as any).data || (rest as any).data;
243+
if ((rest as any).data) { // Check props.data directly first
244+
const passed = (rest as any).data;
245+
if (Array.isArray(passed)) {
246+
setData(passed);
247+
setLoading(false);
248+
return;
249+
}
250+
}
251+
252+
// Check schema.data next
253+
if ((schema as any).data) {
254+
const passed = (schema as any).data;
245255
if (Array.isArray(passed)) {
246256
setData(passed);
247257
setLoading(false);

packages/plugin-map/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export { ObjectMap };
1616
export type { ObjectMapProps };
1717

1818
// Register component
19-
export const ObjectMapRenderer: React.FC<{ schema: any }> = ({ schema }) => {
19+
export const ObjectMapRenderer: React.FC<any> = ({ schema, ...props }) => {
2020
const { dataSource } = useSchemaContext();
21-
return <ObjectMap schema={schema} dataSource={dataSource} />;
21+
return <ObjectMap schema={schema} dataSource={dataSource} {...props} />;
2222
};
2323

2424
console.log('Registering object-map...');

0 commit comments

Comments
 (0)