Hi everyone,
I’d like to highlight a PR that is being worked on by @amirfefer. We are trying to standardize update of data on client side after mutation (create, update, destroy) has been perforemed on server side.
With current approach data fetched from API (usually index action of the resource) are basically read-only, but after some mutation has been done on the server side, we need to update this data to see the change in the UI, as of now the only way to do so is to refetch all the data.
After brief discussion [1] we’ve decided to aim to having as simple basic use cases as possible, to reduce boiler plate and offer basic mutations, that will be expected to respond with appropriate data, that should be replaced. This replacement will be done automatically by the middleware and the API response should be responsible for containing all the necessary data (show endpoint should not be missing any data that are included in index endpoint, what is mostly the case for all our endpoints).
If you require a different API data manipulation, you’d need to add your own custom reducers and actions.
I’m sharing this mostly to draw attention of developers (and plugin maintainers), but if you have ideas how we can handle this better, please share your thoughts.
The PR for update action:
[1] Disscussion recording: https://drive.google.com/file/d/1YcinYZ_1HN_YUGaQrPjb4oq8BQ9Ysxzv/view