signals in For and Index stay in the past if accessed under batch
Describe the bug
Conceptually the signals provided by mapArray (index) and indexArray (value) are derived directly from the input source array. So accessing them during batch should have a similar effect as accessing memos — force them to be updated immediately.
The fact that they are implemented using roots, signals not memos, etc. are internal details, but it causes them to stay in the past until the batch is over, or until they are updated by reading the function returned by mapArray.
I'm sure this is a known bug, but it's probably worth having an open issue for it.
Your Example Website or App
https://playground.solidjs.com/anonymous/31b6b52f-85a6-4fc7-87cc-b46c21430e54
Steps to Reproduce the Bug or Issue
Clicking the buttons will cause the rendered list to update, changing the indexes of individual items.
But the value of the index signal is different depending on if it was read under batch or after it.
Expected behavior
The derived index signal should always be in sync with the input source.
Thanks for reporting. Yeah this is why impure Memos (and createComputed) is awkward. Changing batching model revealed it.
Without reading the source memo there is no ability for this to update before the batch forcibly runs it after.
Not sure if we can feasibly change this before 2.0 but I will consider it.