-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useChannel(false) to prevent eager channel connection #44
Comments
Actually, this works, but it would be nice to not have the warning. I know it helps people if they haven't added a channel, but sometimes you don't want to add a channel. |
All good - I love it. Keen to add it in. Did you want to try a PR? Otherwise I can get to it later in the week. |
We’ve got two options - anything that evaluates to false doesn’t attempt to subscribe OR explicitly pass null to prevent subscription. This might be safer so that it still warns about passing undefined if people are generating channel names with an expression - similar to SWR as you mentioned. |
I personally like the |
Sometimes you don't want to subscribe to a channel until another bit of data is available. It would be nice if you allowed
useChannel
to acceptundefined
,null
, orfalse
as a conditional to wait to subscribe. Similar to howuseSWR
does it.For instance:
In the above example, this prevents sending a subscription request from happening until we get
my.username
. Otherwise we would be subscribing to channel/api/messages/undefined
The text was updated successfully, but these errors were encountered: