From 27b3ab993147859c5cc0ad2ae3cb1b8ff23f721d Mon Sep 17 00:00:00 2001 From: catosaurusrex2003 Date: Sun, 17 Nov 2024 15:55:42 +0530 Subject: [PATCH] logic to rerender --- .../ApplicationErrorHandler/ErrorBoundary.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx b/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx index f1a802687..ecefbaf08 100644 --- a/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx +++ b/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { ReactNode } from 'react'; import { ErrorBoundary, FallbackProps } from 'react-error-boundary'; import { ErrorObject } from '../../types'; @@ -23,8 +23,16 @@ function fallbackRender({ error }: FallbackProps) { } const AsyncApiErrorBoundary = ({ children }: Props) => { + const [key, setKey] = useState(0); + + useEffect(() => { + setKey((prevKey) => prevKey + 1); + }, [children]); + return ( - {children} + + {children} + ); };