qwik: [🐞]Store array update does not rerender list

Which component is affected?

Qwik Runtime

Describe the bug

There is a problem with rendering updated values using list { store.array.map } I can change values only one or twice, depending on code usage after that any further modification is not updating values visually, however store values are changed I’ve created thread on discord https://discord.com/channels/842438759945601056/1191080926554361992 I managed to find a solution and it’s working but it should be used this way

As you can see on the image store.values are different than those that are visible using .map problem

As i mentioned earlier 1 or 2 operations are displayed any further only updates store values but not items rendered via { store.array.map }

IMPORTANT: This code is working in stackblitz https://stackblitz.com/edit/qwik-starter-kzdpd9 (version 1.2.11)

Reproduction

https://qwik.builder.io/playground/#v=1.3.1&f=7VjdbtMwFH4VSxNyAnVI0r80I5UGmgSIAdLgapqQUztrWLdEo6Xrqt7s3fZenGMnTtqU%2FYB2MWmbFDmxfc7xd%2F4%2BtxY0ftCteUp5RjfdVi0YWlUv1kPV3O8RV0reV2id7yBqTyDNoW1xgATBSEVY8IMWvGHlKt8B8nsFZsEklDFRxRGWkLmoDMpI2FB%2BdLwaIv64HyTUVh4VoC2VZdQPuOvLfpe1AzdgHd7rMt5ORmzQd92BL%2BRADHzaKuym309vrrkg84WQo3E2X1CywlM9TJ5Xyds7nZ3NJlhotojiXhz3ZdBmXLY56%2FQ9ybgbJ2zkcVAi3F7P6zZMu%2BL5zXUGjGGLwH7cSdpeIFgwij3WEd2EDQYJZ57vxnGvG7STON4icA64XcnzlBuJx%2FBUwyV4TuahboRYJoy7UlH4SlM77fGhRaletC1FkIyWFI0Cm8mhBYUkmcjLXXLCQYvn5jD8OYNenywYNiaIFIimHDgQi%2BV0LuX5LhCkSzZPxXQckq6LO%2BjKJMotGvDJRHqhGzVQ32wyOwNxSnMHFedcCDhESHxlB7QjyAawKr8k0MXhwDuijf%2FlFLvgIp1ByKndFY8ByycZbNxJkmQX6IUy1XPdFzVLsVz4wz0hkO5AKfBrE6kiwJhzEcX%2BQAHsiIJxP9BzlMCpRnKcYa5GtEwKaqoFFhPF8ityu9TJBuoslWb2ClWb24ApM3hLeKJQ7ot0ei8cJSz8XyAP%2BW%2BpkWyBTEATP9wCZzE02aq2OlXVcuDSYVnF%2B6KlWJ1SpPPH%2BONULqKlml09biIpjfmwLMELJxUr5Apr001Y1L2iOofGphKCqK%2BLWQs524aGUXxX90p9RNq0c7j8ePjls6OLDhyxjOo3r3HfZqPEimR4hMmBkNzVYDS90OVOMfIIGLQmfw5w7f2JxOHbxQdhVdlpA18m778dfFLX2GKNKolpQixc4gD5nMHFVjP7IXG1nlJTiVbTJBKpZXqxbrzWAZ%2BOnWSSZRd6iFef7Azc8ZJYkCfqjzBMGRy8Ip5t41O92s60ZEt22Ul0b6jMVJ8LtzSiNp%2F9GhtvA8qlAL0V4KLAIXA7CDAO2AiS5jExbMKCvZR95SGuqBL8L77YMHItPLWnRHMyFUgha8cwJeDuQHr0Ez1SdJU4%2FFNwwE8R%2B3w0hrIGxzcFzYgHc0cAKomiNZBtUxo2BR4pIcc1n%2BiAK1jJ1shbc6UJxuerztO76vwB

Steps to reproduce

Here are different ways to modify store.arrays: // Not working #1 (can modify 1 element) const category: PartCategoryData = { id: id.value, name: name.value }

store.categories.forEach((c, index) => {
  if (c.id === category.id)
    store.categories[index] = category;
});


// Not working #2 (can modify 1 element)
store.categories = store.categories.map((category) => {
  if (category.id === id.value) {
    return {
      ...category, name: name.value
    };
  }

  return category;
});


// Not working #3 (can modify 1 element)
const modified = store.categories.map((category) => {
  if (category.id === id.value) {
    return {
      ...category, name: name.value
    };
  }

  return category;
});

store.categories.splice(0, store.categories.length, ...modified);


// Not working #4 (can modify 2 elements)
const selectedCategory = store.categories.find(category => category.id === id.value)

if (selectedCategory) {
  selectedCategory.name = name.value;
}


// Not working #5 (can modify 2 elements)
store.categories.forEach(category => {
  if (category.id === id.value) {
    category.name = name.value;
  }
});


// Not working #6 (can modify 2 elements)
for (const category of store.categories) {
  if (category.id === id.value) {
    category.name = name.value;
    break; // If you only want to modify the first matching item
  }
}

// Not working #7 (can modify 1 element)
store.categories = store.categories
.filter(category => !(category.id === id.value))
.concat(store.categories.filter(category => category.id === id.value)
  .map(category => ({ ...category, name: name.value }))
);

System Info

Windows 11, Opera browser, mozilla, edge
In my project im using Qwik ^1.2.15

Additional Information

You can find more on discord thread https://discord.com/channels/842438759945601056/1191080926554361992

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Comments: 23 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Great news! πŸ˜ƒ

I did some test on qwik@1.2.11 and it’s not working there. So only in Stackblitz with qwik 1.2.11 it’s working, might it be environment issue?