performant-software / react-components

A library of shared React components
https://performant-software.github.io/react-components/
MIT License
1 stars 1 forks source link

Core Data components' `onLoad` arguments still include `baseUrl` and `projectIds` #279

Closed camdendotlol closed 3 months ago

camdendotlol commented 3 months ago

In a recent release (2.2.x I think) the way Core Data record services such as PlacesService were called was updated in a way that removes the need to pass baseUrl or projectIds as params when loading records.

However, the useLoader hook (which I think is what the PlacesList, ItemsList, etc. components use to fetch data) still passes these params: https://github.com/performant-software/react-components/blob/4a9cbf30bb0b0ceab8b6079c71371ddd6df34266/packages/core-data/src/hooks/CoreData.js#L59

The services expect the first param to be the request params, so when provided with the base URL they try to request from something like https://uqam.coredata.cloud/core_data/public/v1/places/74003705-759d-4803-ab24-3c79a1b1208e/media_contents?0=h&1=t&2=t&3=p&4=s&5=%3A&6=%2F&7=%2F&8=u&9=q&10=a&11=m&12=.&13=c&14=o&15=r&16=e&17=d&18=a&19=t&20=a&21=.&22=c&23=l&24=o&25=u&26=d&project_ids=14.

This isn't a blocker for me as I can work around it by ignoring the first two args in my callbacks and only using the params in the third argument, but it may affect other cases where a react-components component calls the hook and a downstream application has no control over the arguments.