Skip to content

Commit ba8c686

Browse files
committed
chore(pusher-web): remove excessive logic
1 parent 20113ea commit ba8c686

2 files changed

Lines changed: 3 additions & 25 deletions

File tree

packages/pluggableWidgets/pusher-web/src/Pusher.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classnames from "classnames";
2-
import { ReactElement, useCallback, useMemo } from "react";
2+
import { ReactElement, useMemo } from "react";
33
import { executeAction } from "@mendix/widget-plugin-platform/framework/execute-action";
44
import { PusherContainerProps } from "../typings/PusherProps";
55
import { usePusherSubscribe } from "./hooks/usePusherSubscribe";
@@ -9,40 +9,26 @@ import { getChannelName } from "./utils/getChannelName";
99
export default function Pusher(props: PusherContainerProps): ReactElement {
1010
const { class: className, objectSource, eventHandlers } = props;
1111

12-
// Error callback
13-
const handleError = useCallback((error: Error) => {
14-
console.error("[Pusher] Subscription error:", error.message);
15-
}, []);
16-
17-
// Build channel name based on the object
1812
const channelName = getChannelName(objectSource);
1913

20-
// Setup stable subscription config
2114
const subscription = useMemo(() => {
2215
if (!channelName) {
2316
return undefined;
2417
}
2518

26-
// Build event bindings from configured handlers
2719
const eventBindings = eventHandlers.map(handler => ({
2820
eventName: handler.actionName,
2921
onEvent: () => {
30-
console.debug(`[Pusher] Event received: ${handler.actionName}`);
3122
executeAction(handler.action);
3223
}
3324
}));
3425

35-
// If no valid handlers, return undefined (no subscription)
3626
if (eventBindings.length === 0) {
3727
return undefined;
3828
}
3929

40-
return {
41-
channelName,
42-
eventBindings,
43-
onError: handleError
44-
};
45-
}, [channelName, eventHandlers, handleError]);
30+
return { channelName, eventBindings };
31+
}, [channelName, eventHandlers]);
4632

4733
usePusherSubscribe(subscription);
4834

packages/pluggableWidgets/pusher-web/src/utils/PusherListener.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ export class PusherListener {
3838
}
3939
});
4040

41-
// Setup connection event handlers
4241
this.pusher.connection.bind("error", this.handleConnectionError);
43-
this.pusher.connection.bind("state_change", this.handleStateChange);
4442
}
4543

4644
/**
@@ -69,8 +67,6 @@ export class PusherListener {
6967
// Bind error handler
7068
this.currentChannel.bind("pusher:subscription_error", (error: unknown) => {
7169
if (isAuthError(error)) {
72-
// 403 from auth endpoint — object not yet known to server, silent in happy flow
73-
console.debug("[PusherListener] Channel auth returned 403, skipping subscription.");
7470
return;
7571
}
7672
console.error("[PusherListener] Subscription error:", error);
@@ -121,10 +117,6 @@ export class PusherListener {
121117
private handleConnectionError = (error: unknown): void => {
122118
console.error("[PusherListener] Connection error:", error);
123119
};
124-
125-
private handleStateChange = (states: { previous: string; current: string }): void => {
126-
console.debug(`[PusherListener] State changed: ${states.previous}${states.current}`);
127-
};
128120
}
129121

130122
function isAuthError(error: unknown): boolean {

0 commit comments

Comments
 (0)