S
SolidJS16mo ago
Kasper

How to update store with arary

When updating a store that is an array is this not the correct way updating one of the items? When i do this, no error is thrown but my view is not updated
const [uploadFiles, setUploadFiles] = createStore<FileUpload[]>([]);

...

setUploadFiles((f) => file.fileName === f.fileName, "status", (s) => "uploading");

...

<For each={uploadFiles}>
{(file: FileUpload) => (
<div>
{file.file.name} - {file.status}
</div>
)}
</For>
const [uploadFiles, setUploadFiles] = createStore<FileUpload[]>([]);

...

setUploadFiles((f) => file.fileName === f.fileName, "status", (s) => "uploading");

...

<For each={uploadFiles}>
{(file: FileUpload) => (
<div>
{file.file.name} - {file.status}
</div>
)}
</For>
1 Reply
Kasper
Kasper16mo ago
Was correct, i had an issue where my files where not an array but an object map.