File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 50
50
"react-dom" : " ^18.2.0" ,
51
51
"react-test-renderer" : " ^18.2.0" ,
52
52
"typescript" : " ^5.3.2" ,
53
- "unleash-proxy-client" : " ^3.2.0 " ,
53
+ "unleash-proxy-client" : " ^3.3.0-beta.1 " ,
54
54
"vite" : " ^4.5.0" ,
55
55
"vite-plugin-dts" : " ^3.6.3" ,
56
56
"vitest" : " ^0.34.6"
Original file line number Diff line number Diff line change @@ -58,6 +58,12 @@ const FlagProvider: React.FC<React.PropsWithChildren<IFlagProvider>> = ({
58
58
} ) ;
59
59
} ;
60
60
61
+ const clearErrorCallback = ( e : any ) => {
62
+ startTransition ( ( ) => {
63
+ setFlagsError ( null ) ;
64
+ } ) ;
65
+ }
66
+
61
67
let timeout : any ;
62
68
const readyCallback = ( ) => {
63
69
// wait for flags to resolve after useFlag gets the same event
@@ -70,6 +76,7 @@ const FlagProvider: React.FC<React.PropsWithChildren<IFlagProvider>> = ({
70
76
71
77
client . current . on ( 'ready' , readyCallback ) ;
72
78
client . current . on ( 'error' , errorCallback ) ;
79
+ client . current . on ( 'recovered' , clearErrorCallback ) ;
73
80
74
81
const shouldStartClient = startClient || ! unleashClient ;
75
82
if ( shouldStartClient ) {
@@ -84,6 +91,7 @@ const FlagProvider: React.FC<React.PropsWithChildren<IFlagProvider>> = ({
84
91
if ( client . current ) {
85
92
client . current . off ( 'error' , errorCallback ) ;
86
93
client . current . off ( 'ready' , readyCallback ) ;
94
+ client . current . off ( 'recovered' , clearErrorCallback )
87
95
client . current . stop ( ) ;
88
96
}
89
97
if ( timeout ) {
Original file line number Diff line number Diff line change @@ -1910,10 +1910,10 @@ universalify@^0.2.0:
1910
1910
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0"
1911
1911
integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==
1912
1912
1913
- unleash-proxy-client@^3.2.0 :
1914
- version "3.2.0 "
1915
- resolved "https://registry.yarnpkg.com/unleash-proxy-client/-/unleash-proxy-client-3.2.0. tgz#cdecf1b3bdd40fbe7a20fd66c27906b33e53c4fd "
1916
- integrity sha512-y9iCRCytxQCej6HlXecGu63ul1Wz6xklXOs+vuaPbqtj4NDGT6IThUvP3h7m5pW+IIxR99hnkVS1FICt1FT3yQ ==
1913
+ unleash-proxy-client@^3.3.0-beta.1 :
1914
+ version "3.3.0-beta.1 "
1915
+ resolved "https://registry.yarnpkg.com/unleash-proxy-client/-/unleash-proxy-client-3.3.0-beta.1. tgz#c13f89472af8c992df56295d1b6913c52237dff5 "
1916
+ integrity sha512-Vswscc9+zZyEL0lAtzCvMG2zgu9krbsr6WxWnmk9FEMBHjyz++P3bD8Rtsv3fU1TRheESmjXQk6+a3g8nWRxFw ==
1917
1917
dependencies :
1918
1918
tiny-emitter "^2.1.0"
1919
1919
uuid "^9.0.1"
You can’t perform that action at this time.
0 commit comments