selsamman / proxily

Proxily is a library for managing state in a non-prescriptive way. It re-renders components as state changes. While Proxily does not use immutable state it provides many of the same benefits. There is no need to annotate or describe the state shape as Proxily will discover it as it navigates through the state hierarchy.
MIT License
1 stars 0 forks source link

Warning from react when using useObservableTransition on large writes. #8

Closed seivan closed 2 years ago

seivan commented 2 years ago

Using useObservableTransition to update a bunch of items triggers a warning from React.

  const [isPending, startTransition] = useObservableTransition();
<div>
      <input onChange={(e) => {
        startTransition(() => {
          props.store.todos.forEach(x => {
            x.setText(e.currentTarget.value)
          })
        })
      }
      } value={props.store.todos[0].text} />
      {isPending}
</div>

I thought the whole purpose of startTransition was to work within the new concurrency rules?

seivan commented 2 years ago

Ah looks like it's better to do the actual mutation directly inside startTransition().