Skip to content

Nullable channel results in exceptions #520

@CorwinDev

Description

@CorwinDev

Echo Version

2.3.7

Laravel Version

12.61.1

PHP Version

8.4.21

NPM Version

11.12.1

Database Driver & Version

No response

Description

v2.3.5 released a breaking change making the channel() function nullable, this resulted in errors when trying to access the channel function directly after instantiating the useEcho channel for example.

Furthermore, pusher-js was dropped as dependency which will remove it for users that installed this package standalone (I know that the docs have listed install pusher-js too)

I feel like this update should've been a v3 of this package

Steps To Reproduce

const { channel } = useEchoPresence('online', [], () => { });

channel()
    .here((members: string[]) => {
        // Do something with members
    })

With channel() being null on initial setup the above code will result in Cannot read properties of null (reading 'here')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions