Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/utils/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const convertLegacyData = (data) => {
y: transform.y,
angle: transform.rotation,
metadata: props,
display: 'panelGroup',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The display property is set to 'panelGroup'. In other parts of this function (for strings and other types), the display value is derived from the key by removing the trailing 's' (e.g., 'strings' becomes 'string'). For consistency, should this be 'grid' instead, which would be key.slice(0, -1) and also matches the element type on line 25? If 'panelGroup' is intentional, consider adding a comment to explain why this case is different.

},
});
}
Expand Down Expand Up @@ -93,6 +94,7 @@ export const convertLegacyData = (data) => {
},
attrs: {
metadata: value.properties,
display: key.slice(0, -1),
},
});
}
Expand Down Expand Up @@ -128,6 +130,7 @@ export const convertLegacyData = (data) => {
x: transform.x,
y: transform.y,
metadata: props,
display: key === 'combines' ? 'combiner' : key.slice(0, -1),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic to determine the display type, key === 'combines' ? 'combiner' : key.slice(0, -1), is also used on line 123 for the icon source. This creates duplication. To improve maintainability, you could define a variable at the start of the for loop (around line 104) and reuse it in both places.

For example:

const displayType = key === 'combines' ? 'combiner' : key.slice(0, -1);

Then use displayType for both source and display.

},
});
}
Expand Down