Repository: react
Issue: [React 19] useOptimistic shows wrong value when other actions happen in the background
Labels: React 19

## Summary

Any unrelated background action blocks useOptimistic’s heuristic as to when to revert to the real value.

### Reproduce
1. Open [the demo](https://codesandbox.io/p/sandbox/use-optimistic-multiple-n6hr29?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clzlc8lee0006356jhc9vysql%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clzlc8lee0002356jjit74twl%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clzlc8lee0003356jq656yyz1%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clzlc8lee0005356j3uhkgzsg%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clzlc8lee0002356jjit74twl%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzlc8led0001356jll6xqjiv%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%257D%255D%252C%2522id%2522%253A%2522clzlc8lee0002356jjit74twl%2522%252C%2522activeTabId%2522%253A%2522clzlc8led0001356jll6xqjiv%2522%257D%252C%2522clzlc8lee0005356j3uhkgzsg%2522%253A%257B%2522id%2522%253A%2522clzlc8lee0005356j3uhkgzsg%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzlc8lee0004356jfwwrs2uq%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clzlc8lee0004356jfwwrs2uq%2522%257D%252C%2522clzlc8lee0003356jq656yyz1%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clzlc8lee0003356jq656yyz1%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)

    <details><summary>Code backup</summary>
    
    ```js
    import { useOptimistic, useState } from "react";
    
    const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
    
    export default function App() {
      const [a, setA] = useState(0);
      const [optimisticA, setOptimisticA] = useOptimistic(a);
      async function incA() {
        const newVal = optimisticA + 1;
        setOptimisticA(newVal);
        await sleep(1000);
        return Error("failed");
      }
    
      async function unrelatedSlow() {
        await sleep(20000);
      }
    
      return (
        <div className="App">
          <div>
            <form action={incA}>
              {optimisticA} <button disabled={optimisticA !== a}>Inc</button>
            </form>
          </div>
          <div>
            <form action={unrelatedSlow}>
              <button>Unrelated slow</button>{" "}
            </form>
          </div>
        </div>
      );
    }
    
    ```

2. Click on Inc.
3. Observe how after 1 second and a simulated server failure the number goes back to 0.
4. Click on Unrelated slow.
5. Click on Inc.

Expected: after 1 second number goes back to 0, same as before.
Actual: the number stays at 1 for 20 seconds, until the unrelated action completes.