#5264·preact

Uncaught render error permanently drops the other components queued in the same pass

Author: dmailCreated Sep 24, 2026Updated Sep 24, 2026

Hello there, I had an issue while using preact and I've redacted the following bug report with the help of an IA.

Describe the bug

When a component throws during process() (the rerender queue flush) and no error boundary handles it, every other component still waiting in rerenderQueue is dropped by the finally block while keeping COMPONENT_DIRTY (_dirty in v10). Because enqueueRender only pushes a component when it is not dirty, those components can never be scheduled again: their later setState / forceUpdate / signal updates are silently ignored until a parent happens to re-render them.

javascript
// src/component.js
function process() {
	try {
		while (rerenderQueue.length) { … renderComponent(c); … }
	} finally {
		rerenderQueue.length = rerenderCount = 0; // remaining components stay dirty
	}
}

Affected: 11.0.0-rc.2 (and main), 10.29.x — the try/finally comes from #5017 ("Ensure we reset renderCount"), forwardported in #5053. Before it (≤ 10.28) the situation was worse (nothing rendered again because _rerenderCount was never reset), so this is a partial fix rather than a regression — but the components caught in the aborted pass are still lost.

In practice this surfaces as "part of the page stopped updating after an error": with @preact/signals, a component whose updater ran in the same tick as a throwing one never re-renders from its signals again. An error boundary that keeps the error in state and re-throws from render on later renders makes it worse, because every re-render of that boundary aborts a pass and kills whatever shared it.

To Reproduce

javascript
import { Component, render } from "preact";

class Thrower extends Component {
  state = { throwing: false };
  componentDidMount() { window.thrower = this; }
  render() {
    if (this.state.throwing) throw new Error("boom");
    return <div><Deep /></div>;
  }
}
class Deep extends Component {
  render() { return <Counter />; }
}
class Counter extends Component {
  state = { n: 0 };
  componentDidMount() { window.counter = this; }
  render() { return <p id="counter">{this.state.n}</p>; }
}
render(<Thrower />, document.body);

// same tick: the shallow component will throw, the deep one has a pending update
window.thrower.setState({ throwing: true });
window.counter.setState({ n: 1 });

// later, on its own
setTimeout(() => {
  window.counter.setState({ n: 2 });
  setTimeout(() => console.log(document.querySelector("#counter").textContent), 50);
}, 100);

Logged: 0. Counter never renders 1 (expected: dropped with the failed pass) and never renders 2 either (the bug).

Expected behavior

Counter renders 2: an uncaught error in one component's render should not permanently disable unrelated components that happened to be queued in the same pass. Either keep them in the queue and reschedule, or clear their dirty bit so a later update can queue them again. What I tested locally:

javascript
} finally {
	rerenderCount = 0;
	if (rerenderQueue.length) (options.debounceRendering || queueMicrotask)(process);
}

The component that threw already had its dirty bit cleared before rendering and is no longer in the queue, so this does not loop on it; the remaining ones render on the next microtask. With this change the reproduction logs 2.