Skip to content

Commit beff1b4

Browse files
justin808claude
andcommitted
Fix TypeScript import errors in RSCRoute and RSCProvider
Changed from `import ReactClient from 'react/index.js'` to the simpler and more compatible `import * as React from 'react'`. The 'react/index.js' path caused module resolution issues in Jest and TypeScript errors without esModuleInterop. The simpler import works correctly in all environments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bacec63 commit beff1b4

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

packages/react-on-rails-pro/src/RSCProvider.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
*/
1414

1515
import type { ReactNode } from 'react';
16-
import ReactClient from 'react/index.js';
16+
import * as React from 'react';
1717
import type { ClientGetReactServerComponentProps } from './getReactServerComponent.client.ts';
1818
import { createRSCPayloadKey } from './utils.ts';
1919

20-
const React = ReactClient;
21-
2220
type RSCContextType = {
2321
getComponent: (componentName: string, componentProps: unknown) => Promise<ReactNode>;
2422

packages/react-on-rails-pro/src/RSCRoute.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
/// <reference types="react/experimental" />
1616

1717
import type { ReactNode } from 'react';
18-
import ReactClient from 'react/index.js';
18+
import * as React from 'react';
1919
import { useRSC } from './RSCProvider.tsx';
2020
import { ServerComponentFetchError } from './ServerComponentFetchError.ts';
2121

22-
const React = ReactClient;
23-
2422
/**
2523
* Error boundary component for RSCRoute that adds server component name and props to the error
2624
* So, the parent ErrorBoundary can refetch the server component

0 commit comments

Comments
 (0)