FAQ | This is a LIVE service | Changelog

Asset records should be re-fetched after {put,post,patch}Asset

By design {put,patch,post}Asset do not returnt he full asset resource in their response. After a successful PUT, POST or PATCH, the asset should be re-fetched by URL via getAsset. As a suggested implementation, {put,patch,post}Asset could be refactored to be a thunk implemented something like the following untested code:

const postAsset = asset => dispatch => {
    dispatch(/* ... existing RSAA action ... */)
    .then(({ error, payload: { url } }) => {
        if(!error) {
            // succeeded, refetch asset
            return dispatch(getAsset(url));
        }
    });
}