Skip to content

1042 relation data path formatter #1447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: 1.x
Choose a base branch
from

Conversation

sholzer
Copy link
Contributor

@sholzer sholzer commented May 7, 2025

Changes in this pull request

Resolves #1042

Additional info

@sholzer sholzer requested a review from markus-moser May 7, 2025 16:32
return acc
}, {})

const { data } = await store.dispatch(api.endpoints.dataObjectFormatPath.initiate({
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some kind of caching here so that we don't request items with the same context information again after we already requested it? (so just remember the result in a local ref or so)

<Tag
bordered={ false }
color="geekblue"
><SanitizeHtml html={ info.getValue() ?? '' } /></Tag>
Copy link
Contributor

Choose a reason for hiding this comment

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

This works for many-to-many-relations but unfortunately it seems that we need to find other locations where we need to apply this for the other multi-relation data types:

image

@@ -79,7 +81,7 @@ export const ManyToManyRelation = (props: ManyToManyRelationProps): React.JSX.El
}
}, [JSON.stringify(props.value)])

if (props.isLoading === true) {
if (isLoading || props.isLoading === true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The loading state here seemed to be a good idea, but it's a bit annoying that the full data type has a loading state - especially when a new item is added via the tree. The grid data type itself also provides a loading prop. Maybe it's better to just set the grid itself to loading instead of everything? Not sure how easy it's possible but in a perfect world we would see the loading spinner directly on row level for newly added items (and only for the initial load we use the global one).

@@ -33,22 +38,47 @@ interface UseValueReturn {
addItems: (items: ManyToManyRelationValueItem[]) => void
addAssets: (assets: Asset[]) => Promise<void>
maxRemainingItems?: number
pathFormatterClass?: string | null
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently we have the loading spinner + the triggered format-path request also when no path formatter is configured. We need to find a way to skip the path formatter logic when no pathFormatterClass is defined.

body: {
objectId: dataObjectId,
targets,
context: {
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be a bit tricky but we need to somehow find a way to respect the different possible context cases:

https://github.com/pimcore/studio-backend-bundle/blob/75ac539df3485d772261d8645d50765710ac0647/src/DataObject/Legacy/PathFormatterHelper.php#L46

Copy link

sonarqubecloud bot commented May 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 New Major Issues (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@markus-moser markus-moser added this to the next milestone May 9, 2025
@sholzer sholzer marked this pull request as draft May 15, 2025 07:44
@markus-moser markus-moser removed this from the next milestone May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Data Object Editor] Relation data types path formatter
2 participants