Skip to content

The best-practice to always re-fetch the data after saving

The best-practice to always re-fetch the data after saving


This document represents an architecture decision record (ADR) and has been mirrored from the ADR section in our Shopware 6 repository. You can find the original version here


We should always re-fetch the entity data after saving within admin pages.


Reload the data after each saving progress to ensure the user will work only the latest data.

When you save data without reloading the entity, then you need to re-assign the values. But you can't be sure, that these values are the latest ones, because of possible data inconsistency during the saving process. That's why re-fetching data is always important for further CRUD operations.

For example:

<!-- we change the status by click to switch for example -->

<!-- we will save data with onSave method -->
<sw-button-process @click="onSave">
    {{ $tc('') }}

// This method for button save
onSave() {, Shopware.Context.api).then(() => {
        // We should add the method to re-fetch the entity data after save success here

// This method to re-fetch the data
loadEntityData() {
    const criteria = new Criteria();
    const context = { ...Shopware.Context.api, inheritance: true };

    this.repository.get(, context, criteria).then((data) => { = data;


Consistent and CRUD-ready data in your administration.