Skip to content

Commit 6d93600

Browse files
committedFeb 13, 2025
fix: prevent destroy/render remote component every time rerendering from host
1 parent 4ef21d2 commit 6d93600

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎packages/bridge/bridge-react/src/remote/create.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef } from 'react';
1+
import React, { forwardRef, useMemo } from 'react';
22
import {
33
ErrorBoundary,
44
ErrorBoundaryPropsWithComponent,
@@ -102,7 +102,7 @@ export function createRemoteComponent<T, E extends keyof T>(
102102

103103
return forwardRef<HTMLDivElement, ProviderParams & RawComponentType>(
104104
(props, ref) => {
105-
const LazyComponent = createLazyRemoteComponent(info);
105+
const LazyComponent = useMemo(() => createLazyRemoteComponent(info), []);
106106
return (
107107
<ErrorBoundary FallbackComponent={info.fallback}>
108108
<React.Suspense fallback={info.loading}>

0 commit comments

Comments
 (0)