-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to react 18 #176
Upgrade to react 18 #176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecated APIs should be replaced:
eg: https://react.dev/reference/react-dom/hydrate
return new Promise<void>(resolve => { | ||
const root = ReactDOMClient.hydrateRoot(container, children); | ||
root.render(children); | ||
resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still trying to figure out how to resolve this promise now
mounted?.(); | ||
}, []); | ||
|
||
return isMounted ? <>{children}</> : <></>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await loadScript(externalLibsPath + "react/umd/react.production.min.js", view); /* React */ | ||
await loadScript(externalLibsPath + "react-dom/umd/react-dom.production.min.js", view); /* ReactDOM */ | ||
|
||
await loadScript(externalLibsPath + "react/umd/react.development.js", view); /* React */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not merge this
@@ -102,10 +103,12 @@ | |||
|
|||
<ItemGroup> | |||
<EmbeddedResource Include="node_modules\react\umd\react.production.min.js" /> | |||
<EmbeddedResource Include="node_modules\react\umd\react.development.js" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not merge
@@ -10,6 +10,7 @@ | |||
<UseWpf>true</UseWpf> | |||
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput> | |||
<Configurations>Debug;Release;ReleaseAvalonia;ReleaseWPF</Configurations> | |||
<EnableWindowsTargeting>true</EnableWindowsTargeting> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not merge
} | ||
|
||
export function ComponentWithMountCallback({ mounted, children }: PropsWithChildren<IComponentWithMountCallbackProps>): JSX.Element | null { | ||
const [isMounted, setIsMounted] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ref... otherwise this leads to an extra render
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually wanted this way because I was getting a crash stating that there was a render after the hydration
this is basically avoiding 1 render to fix that hydration issue - by postponing the render in a way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don get it... I stand with my opinion
I still need to run some tests first locally, but this PR serves as a tentative react upgrade