Search code examples
bulkshopware

What are the technical reasons for the warning in the new bulk edit in Shopware 6.4.5.0?


Shopware 6.4.5.0 now has bulk edit.

When applying changes there is a scary warning popup.

Warning

I had a look at the network tab when changing 2 products, and there is only a single call too the sync-endpoint:

Request

So I am actually still wondering why this warning is there and if it is safe to use bulk edit, for example on unstable connections (I guess closing the browser tab or a unstable connection would have similar results?)

  1. What are the technical reasons behind this message?
  2. Shall we only not close the browser or will a breaking connection also cause problems?
  3. Can the bulk edit be made safer (for example by pushing the changes into the background-queue and execute it without the need for an active browser connection)?

Solution

  • Bulk edit requests are executed via JavaScript. The reason you only see one request is because you are editing fewer than 50 entities, which is the chunk size for the request; ref. onSave() method:

            async onSave() {
                this.isLoading = true;
                this.onProcessData();
    
                const payloadChunks = chunk(this.selectedIds, 50);
    
                const requests = payloadChunks.map(payload => {
                    return this.bulkEditApiFactory.getHandler('product')
                        .bulkEdit(payload, this.bulkEditSelected);
                });
    
                this.bulkEditSelected = [];
    
                return Promise.all(requests)
                    .then(response => {
                        const isSuccessful = response.every(item => item.success === true);
                        this.processStatus = isSuccessful ? 'success' : 'fail';
                    }).catch(() => {
                        this.processStatus = 'fail';
                    }).finally(() => {
                        this.isLoading = false;
                    });
            },

    h/t to my colleague David Neustadt for pointing out the chunking.