belst
Avoiding rerenders using `setState + reconcile`
Hi,
Currently I have a webworker producing data slices which I want to render.
It looks a bit like this:
The problem is, when I have a
<For each={state.events}>
somewhere, the whole loop keeps rerendering, even if only a few elements have been prepended (they always get prepended).
I thought of trying to specify the key in reconcile (the data itself doesn't change, just position in the array) but it is 2 levels deep. The events array is of type:
the key would be data.timestamp
which is guaranteed to be unique, even over different data kinds.
reconcile expects the key to be a string tho which I can only provide for 1 level.
Am I misunderstanding something completely or is this really hard to achieve?21 replies