Conversation
…ring schema spreads.
silviubogan
left a comment
There was a problem hiding this comment.
HTH. The bugs in the UX look solved on my side. Congrats!
| const fetcher = useFetcher(); | ||
| const location = useLocation(); | ||
| const cancelHref = | ||
| content['@id'] || getContentPathFromCmsUrl(location.pathname) || '/'; |
There was a problem hiding this comment.
|| '/' is useless because getContentPathFromCmsUrl cannot return falsy value because location is a Location object which cannot have a falsy pathname because, as written in the docs: https://api.reactrouter.com/v8/interfaces/react-router.Location.html#pathname, pathname always starts with an / and so is never an empty string (which would be falsy).
| typeof extraFieldProps.description === 'string' | ||
| ? extraFieldProps.description | ||
| : undefined, | ||
| placeholder: fieldProps.placeholder || 'Type something...', |
There was a problem hiding this comment.
I believe that this string should be translateable.
| const cli = context.get(ploneClientContext); | ||
|
|
||
| const path = `/${params['*'] || ''}`; | ||
| const path = getContentPathFromCmsUrl(`/${params['*'] || ''}`) || '/'; |
There was a problem hiding this comment.
I think here we have the same issue: getContentPathFromCmsUrl cannot return falsy values.
| return ( | ||
| <ObjectBrowserProvider config={{ ...rest, initialPath: content?.['@id'] }}> | ||
| <ObjectBrowserProvider | ||
| config={{ ...rest, initialPath: loaderData?.content?.['@id'] || '/' }} |
There was a problem hiding this comment.
Is it a good idea to put || getContentPathFromCmsUrl(location.pathname) before the ||, where location is retrieved with useLocation from React Router?
| import type { RootLoader } from '@plone/aurora/app/root'; | ||
|
|
||
| function removeObjectIdFromURL(basePath: string, scale: string) { | ||
| if (typeof scale !== 'string') return scale; |
There was a problem hiding this comment.
According to the argument type scale: string in the first line above, this condition is never true.
| download: removeObjectIdFromURL(basePath, image.download), | ||
| }; | ||
|
|
||
| if (!imageInfo.scales || typeof imageInfo.scales !== 'object') { |
There was a problem hiding this comment.
typeof imageInfo.scales !== 'object' is true when !imageInfo.scales, so we can keep only the second condition, imageInfo.scales !== 'object', if we are sure that imageInfo.scales is never null which has type object.
| contentId: string, | ||
| filename: string, | ||
| ): Promise<NamedBlobImage | null> { | ||
| const path = contentId.startsWith('/') ? contentId : `/${contentId}`; |
There was a problem hiding this comment.
Is it probable that contentId can either start or not with / in this place?
Fixes #163
This issue happened because the Image add Content tab spread the full JSON Schema onto React Aria widgets, so object fields crashed the route. The image object browser then fetched
/@objectBrowserWidget/@@add, which is a CMS route rather than a content path, so React Router had no result for that resource. Close did nothing on add because it linked tocontent['@id'], which a new item does not have yet. Save then failed because the Image field stored a URL string whilecreateContentexpects a NamedBlobImage object (data,encoding,content-type,filename).This fix registers ImageWidget for REST API Image and file fields, forwards only a small set of widget props, maps
/@@addand/@@editto a real content path before loading the object browser, and points Close at that path (or the item@idon edit). Uploads write a NamedBlobImage payload; picking an existing image copies that file into the same shape so Save can succeed. Image scale flattening also skips missingscales/downloadso blob images do not take down the view.Caution
The Volto Team has suspended its review of new pull requests from first-time contributors until the release of Plone 7, which is preliminarily scheduled for the second quarter of 2026.
Read details.
If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.
Closes #