remove concurrentRoot

This commit is contained in:
Maciej Jastrzębski
2026-01-01 15:27:59 +01:00
parent 0408e91b2c
commit 7d3dbfa329
9 changed files with 7 additions and 66 deletions
-3
View File
@@ -2,7 +2,4 @@ import { resetToDefaults, configure } from './src/pure';
beforeEach(() => {
resetToDefaults();
if (process.env.CONCURRENT_MODE === '0') {
configure({ concurrentRoot: false });
}
});
-1
View File
@@ -16,7 +16,6 @@ test('configure() overrides existing config values', () => {
asyncUtilTimeout: 5000,
defaultDebugOptions: { message: 'debug message' },
defaultIncludeHiddenElements: false,
concurrentRoot: true,
});
});
-5
View File
@@ -54,11 +54,6 @@ test('renderAsync with wrapper option', async () => {
expect(screen.getByTestId('inner')).toBeTruthy();
});
test('renderAsync supports legacy rendering option', async () => {
await renderAsync(<View testID="test" />, { concurrentRoot: false });
expect(screen.root).toBeOnTheScreen();
});
test('rerender function throws error when used with renderAsync', async () => {
await renderAsync(<Banana />);
-9
View File
@@ -48,15 +48,6 @@ test('renderHookAsync with wrapper option', async () => {
expect(result.current).toEqual('provided');
});
test('renderHookAsync supports legacy rendering option', async () => {
function useTestHook() {
return React.useState(42)[0];
}
const { result } = await renderHookAsync(useTestHook, { concurrentRoot: false });
expect(result.current).toEqual(42);
});
test('rerenderAsync function updates hook asynchronously', async () => {
function useTestHook(props: { value: number }) {
const [state, setState] = React.useState(props.value);
+5 -18
View File
@@ -74,6 +74,11 @@ class Banana extends React.Component<any, { fresh: boolean }> {
}
}
test('supports basic rendering', () => {
render(<View testID="test" />);
expect(screen.root).toBeOnTheScreen();
});
test('UNSAFE_getAllByType, UNSAFE_queryAllByType', () => {
render(<Banana />);
const [text, status, button] = screen.UNSAFE_getAllByType(Text);
@@ -204,14 +209,6 @@ test('returns host root', () => {
expect(screen.root.props.testID).toBe('inner');
});
test('returns composite UNSAFE_root', () => {
render(<View testID="inner" />);
expect(screen.UNSAFE_root).toBeDefined();
expect(screen.UNSAFE_root.type).toBe(View);
expect(screen.UNSAFE_root.props.testID).toBe('inner');
});
test('container displays deprecation', () => {
render(<View testID="inner" />);
@@ -234,16 +231,6 @@ test('returned output can be spread using rest operator', () => {
expect(rest).toBeTruthy();
});
test('supports legacy rendering', () => {
render(<View testID="test" />, { concurrentRoot: false });
expect(screen.root).toBeOnTheScreen();
});
test('supports concurrent rendering', () => {
render(<View testID="test" />, { concurrentRoot: true });
expect(screen.root).toBeOnTheScreen();
});
test('rerenderAsync updates the component asynchronously', async () => {
const fn = jest.fn();
const result = render(<Banana onUpdate={fn} />);
-7
View File
@@ -13,12 +13,6 @@ export type Config = {
/** Default options for `debug` helper. */
defaultDebugOptions?: Partial<DebugOptions>;
/**
* Set to `false` to disable concurrent rendering.
* Otherwise `render` will default to concurrent rendering.
*/
concurrentRoot: boolean;
};
export type ConfigAliasOptions = {
@@ -29,7 +23,6 @@ export type ConfigAliasOptions = {
const defaultConfig: Config = {
asyncUtilTimeout: 1000,
defaultIncludeHiddenElements: false,
concurrentRoot: true,
};
let config = { ...defaultConfig };
+1 -10
View File
@@ -20,13 +20,6 @@ export interface RenderAsyncOptions {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
wrapper?: React.ComponentType<any>;
/**
* Set to `false` to disable concurrent rendering.
* Otherwise `render` will default to concurrent rendering.
*/
// TODO: should we assume concurrentRoot is true for react suspense?
concurrentRoot?: boolean;
createNodeMock?: (element: React.ReactElement) => unknown;
}
@@ -40,12 +33,10 @@ export default async function renderAsync<T>(
component: React.ReactElement<T>,
options: RenderAsyncOptions = {},
) {
const { wrapper: Wrapper, concurrentRoot, ...rest } = options || {};
const { wrapper: Wrapper, ...rest } = options || {};
const testRendererOptions: TestRendererOptions = {
...rest,
// @ts-expect-error incomplete typing on RTR package
unstable_isConcurrent: concurrentRoot ?? getConfig().concurrentRoot,
};
const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);
-6
View File
@@ -28,12 +28,6 @@ export type RenderHookOptions<Props> = {
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
wrapper?: React.ComponentType<any>;
/**
* Set to `false` to disable concurrent rendering.
* Otherwise `renderHook` will default to concurrent rendering.
*/
concurrentRoot?: boolean;
};
export function renderHook<Result, Props>(
+1 -7
View File
@@ -19,12 +19,6 @@ export interface RenderOptions {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
wrapper?: React.ComponentType<any>;
/**
* Set to `false` to disable concurrent rendering.
* Otherwise `render` will default to concurrent rendering.
*/
concurrentRoot?: boolean;
createNodeMock?: (element: React.ReactElement) => unknown;
}
@@ -39,7 +33,7 @@ export default function render<T>(component: React.ReactElement<T>, options: Ren
}
export function renderInternal<T>(component: React.ReactElement<T>, options?: RenderOptions) {
const { wrapper: Wrapper, concurrentRoot, ...rest } = options || {};
const { wrapper: Wrapper, ...rest } = options || {};
const testRendererOptions: RootOptions = {
...rest,