Repository navigation
Description
Summary
Activating a component-local query$ can leave the Octane scheduler unable to stabilize when an acyclic chain of derived$ values reads a pending nested snapshot. The request in the reproduction resolves immediately, but act() reaches its 100-iteration drain limit before the rendered result can settle.
Reproduction
Tested against the tree of octanejs/octane main at commit 7a92ad2a158944cec109ba35e8caa5561cfd7041, with Node 22.23.0, Vitest 4.1.10 and jsdom. Install the repository dependencies, then add these two files at the repository root paths shown below.
packages/octane/tests/signal-pending-issue-repro.test.ts:
import { describe, expect, it } from 'vitest';
import { act } from 'octane';
import * as signals from 'octane/signals';
import { mount } from './_helpers.js';
import { loadCompiledFixtureSource } from './_server-fixture.js';
const { App } = loadCompiledFixtureSource<any>(
`import { derived$, query$, signal$, skip } from 'octane/signals';
export function App(props) @{
const active$ = signal$(false);
const eligible$ = derived$(() => props.enabled);
const primary$ = query$(() => active$.get() && eligible$.get() ? props.key : skip, props.load);
const latest$ = derived$(() => primary$.latest(undefined));
const usePrimary$ = derived$(() => primary$.snapshot().status !== 'error' || latest$.get() !== undefined);
const selected$ = derived$(() => {
if (!active$.get() || !eligible$.get()) return null;
if (usePrimary$.get()) return latest$.get() ?? primary$.get();
return null;
});
const available$ = derived$(() => {
const snapshot = selected$.snapshot();
return snapshot.status === 'ready' && snapshot.value !== null;
});
const fallback$ = derived$(() => selected$.snapshot().status !== 'ready');
const visible$ = derived$(() => String(available$.get()) + ':' + String(fallback$.get()));
<main>
<button onClick={() => active$.set(true)}>{'load'}</button>
<p>{fallback$.get() ? 'pending' : 'settled'}</p>
<span>{visible$.get() as string}</span>
</main>
}`,
{
id: '/signal-pending-issue-repro.tsrx',
mode: 'client',
compileOptions: { dev: true, strong: false, hmr: false },
runtimeModules: { 'octane/signals': signals },
},
);
describe('pending derived snapshot', () => {
it('stabilizes after a query becomes ready', async () => {
const calls: string[] = [];
const load = (key: string) => {
calls.push(key);
return Promise.resolve('value');
};
const root = mount(App, { key: 'a', enabled: true, load });
try {
expect(root.find('span').textContent).toBe('false:false');
await act(() => root.click('button'));
expect(calls).toEqual(['a']);
expect(root.find('span').textContent).toBe('true:false');
} finally {
root.unmount();
}
});
});vitest.signal-upstream-issue.config.mjs:
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
import { octane } from './packages/octane/src/compiler/vite.js';
const root = resolve(import.meta.dirname, 'packages/octane');
const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'));
const alias = Object.entries(pkg.exports).map(([name, target]) => ({
find: name === '.' ? 'octane' : 'octane' + name.slice(1),
replacement: resolve(root, typeof target === 'string' ? target : target.default),
})).sort((a, b) => b.find.length - a.find.length);
export default defineConfig({
resolve: { alias },
plugins: [octane({ hmr: false })],
test: {
environment: 'jsdom',
setupFiles: ['packages/octane/tests/_per-test-setup.ts'],
include: ['packages/octane/tests/signal-pending-issue-repro.test.ts'],
},
});Run:
./node_modules/.bin/vitest run -c vitest.signal-upstream-issue.config.mjs --reporter=verboseExpected: The click starts a single request and the visible result eventually becomes true:false.
Actual: The click fails with act(): scheduler did not stabilize after 100 iterations — likely an infinite render loop, before the final assertion. The compiled fixture uses development mode with Strong disabled; the signal graph contains no intentional cycle.
Activity
domgan-oai commentedon Oct 5, 2026
Additional reproduction: a layout-effect microtask activates a deferred query. A derived value reads the query, and two other derived values consume its snapshot.
On current main (7a92ad2), the jsdom test below fails at the first
actwith “scheduler did not stabilize after 100 iterations,” before reaching the click. A separate Chromium test using the published 0.9.1 package also stalls with a busy renderer while the query is pending; an instrumented run shows the click handler enters and exits, but the awaited interaction does not complete. Resolving the query before the interaction is a passing control.To reproduce in the repository, add the following fixture and test under the existing Octane test directories and run the signals test project. The test uses the existing test helpers.
Fixture:
packages/octane/tests/_fixtures/signal-layout-microtask-repro.tsrxTest:
packages/octane/tests/signals-layout-microtask-repro.test.tsfix(octane): compare captured signal handles by the cell they resolve…