From 08efa907206c10aec7bdb4d0a7c2203710fde24b Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Mon, 20 Jun 2022 16:35:37 +0900 Subject: [PATCH 1/2] use jsx ppx for error boundary comp --- src/RescriptReactErrorBoundary.res | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/RescriptReactErrorBoundary.res b/src/RescriptReactErrorBoundary.res index 3032f14..af733e0 100644 --- a/src/RescriptReactErrorBoundary.res +++ b/src/RescriptReactErrorBoundary.res @@ -14,7 +14,7 @@ type params<'error> = { info: info, } -let getErrorBoundary = %raw(` +let getErrorBoundary: reactComponentClass => React.element = %raw(` function (Component) { function ErrorBoundary(props) { Component.call(this); @@ -31,12 +31,6 @@ let getErrorBoundary = %raw(` } `) -@obj -external makeProps: ( - ~children: React.element, - ~fallback: params<'error> => React.element, - ~key: string=?, - unit, -) => {"children": React.element, "fallback": params<'error> => React.element} = "" - -let make = getErrorBoundary(component) +@react.component +let make = (~children as _: React.element, ~fallback as _: params<'error> => React.element) => + getErrorBoundary(component) From 8704f7850ae6e4844e5380f524ebc2d51acabcd3 Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Mon, 20 Jun 2022 17:21:09 +0900 Subject: [PATCH 2/2] update change log --- Changes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index bcec602..b78c0fa 100644 --- a/Changes.md +++ b/Changes.md @@ -2,7 +2,7 @@ ## master -- Nothing yet +- Rewrite the `RescriptReactErrorBoundary` component implementation with `@react.component`, so it can be compatible with the changes of JSX PPX. ## v0.10.3 @@ -26,12 +26,14 @@ For history on previous evolution of the code, check out the original [reason-re - **IMPORTANT:** Currently, old third-party packages that are still dependent on `reason-react` will not mix with other `@rescript/react` based code due to a build system problem. Which means that every third-party dependency needs to be upgraded to `@rescript/react` first to make it compatible. See [this forum discussion](https://forum.rescript-lang.org/t/discussion-reason-react-rescript-react-migration-path/1086) for more details. - Removed legacy modules ("record api"): + - `ReasonReactCompat` - `ReactDOMServerRe` - `ReactEventRe` - `ReasonReactOptimizedCreateClass` - Renamed existing modules: + - `ReasonReactErrorBoundary` -> `RescriptReactErrorBoundary` - `ReasonReactRouter` -> `RescriptReactRouter` - (Note: Usually the two only valid styles would be `ReScript` or `rescript`, the latter being the version for technical writing. We are using `Rescript` here, since it is essentially the capitalized version of `rescript`)