We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a09add5 commit b919a31Copy full SHA for b919a31
js/Ice/react-greeter/src/App.tsx
@@ -43,17 +43,14 @@ function App(): JSX.Element {
43
}
44
45
return () => {
46
- const cleanup = async () => {
47
- try {
48
- if (communicatorRef.current) {
49
- await communicatorRef.current.destroy();
50
- }
51
- } catch (err) {
52
- console.warn("Failed to destroy communicator:", err);
53
54
- };
55
- // Kick off the async cleanup, but don't return the promise
56
- cleanup();
+ const communicator = communicatorRef.current;
+ communicatorRef.current = null;
+ // Clean up the communicator when the component unmounts
+ if (communicator) {
+ communicator.destroy().catch((err) => {
+ console.error("Error destroying Ice communicator:", err);
+ });
+ }
57
};
58
}, []);
59
0 commit comments