chore(pusher-web): initial implementation#2224
Conversation
AI Code Review
What was reviewed
Skipped (out of scope): Findings🔶 Medium — Subscription never fires after config loadsFile: Fix: Add useEffect(() => {
const listener = listenerRef.current;
if (!listener || !subscription) {
return;
}
listener.subscribe(subscription);
return () => {
listener.unsubscribe();
};
}, [subscription, pusherConfig]); // pusherConfig triggers re-run when listener is created🔶 Medium — Async fetch without unmount guardFile: Fix: useEffect(() => {
let active = true;
const controller = new AbortController();
fetch(endpoint, { signal: controller.signal, credentials: "same-origin", headers: { "X-Csrf-Token": csrfToken } })
.then(res => { ... return res.text(); })
.then(data => {
if (active) setConfig({ ... });
})
.catch(err => {
if (active) console.error("[usePusherConfig]", err);
});
return () => {
active = false;
controller.abort();
};
}, []);🔶 Medium — No unit tests for a new widgetFile: Fix: Add tests using
|
Pull request type
Description