Open mdrews21 opened 2 months ago
Hi,
Thanks for opening this issue. The reason why there is an additional GET after PATCH/POST/DELETE operations is twofold.
Firstly, while the JSONAPI standard says that the 200 response can be empty if the server-side changes directly matches the PATCH. However many servers get this wrong, returning empty data when in fact something else is changed server-side. So this GET ensures the client is synced with the server.
Secondly, the PATCH object will only contain 'one side' of any patched relationships. In most cases it is easier to just GET any related items (via includes) after the PATCH, than try to walk the patched relationships locally and manually update the store.
It is currently possible to turn off the following of includes
by setting relatedIncludes
to false
in the config (so it will only get the 'main' object).
However you are right that it should be the case that there should be a way to disable this GET via a config option, so I'll look at adding one in.
Finally if it is left enabled then it should probably prefer the self
url in links
and fall back to building it from type
and id
only if it's missing.
I've added this functionality as a config option called getAfterWrite
- this defaults to true
but if you set it to false
it should do what you need.
(The URL used in the GET is also now the self
link url which should fix the issue if your paths aren't /type/id
)
Let me know if you have any problems with this - released as 6.6.0
.
After successful patchRelated-action the package calls a GET action on our api (e.g. "tags" of a product)
In my opinion it is better to completely disable the GET action after patchRelated, or disable it via config