Skip to content

Commit

Permalink
Prevent infinite recursion in case of error on initial render
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWilson committed Nov 24, 2023
1 parent 479c7ef commit 18284cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/UI/CommonUI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ module ReactErrorBoundary =

override this.render() =
let setError v = this.setState(fun _ _ -> { Error = v })
let clearError = fun () -> setError None
WindowProtector(this.state.Error, setError, this.props.Inner)
WindowProtector(this.state.Error, setError, if this.state.Error.IsSome then Html.div (this.state.Error.ToString()) else this.props.Inner)

let renderCatchSimple errorElement element =
ReactElementType.create ReactElementType.ofComponent<ErrorBoundary,_,_> { Inner = element; ErrorComponent = errorElement; OnError = fun _ -> () } [ ]
Expand Down

0 comments on commit 18284cb

Please sign in to comment.