11import classnames from "classnames" ;
2- import { ReactElement , useCallback , useMemo } from "react" ;
2+ import { ReactElement , useMemo } from "react" ;
33import { executeAction } from "@mendix/widget-plugin-platform/framework/execute-action" ;
44import { PusherContainerProps } from "../typings/PusherProps" ;
55import { usePusherSubscribe } from "./hooks/usePusherSubscribe" ;
@@ -9,40 +9,26 @@ import { getChannelName } from "./utils/getChannelName";
99export 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
0 commit comments