-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Update type signature for SubscriptionHandler. Update associated docs. #328
Update type signature for SubscriptionHandler. Update associated docs. #328
Conversation
Makes sense 👍 Void isn't actually a type so I think it should be avoided where possible. The only place I've found it valuable is when stating "I don't care about this value" which is almost always exclusive to function arguments and their return types. interface Props {
onClick: (e: MouseEvent) => void;
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, the issue did mention something about useRequest as well, is this in scope of this PR?
@@ -1,21 +1,35 @@ | |||
## About | |||
|
|||
This is a basic example of subscriptions being used with URQL. | |||
This is a basic example of subscriptions being used with `urql`. It demonstrates some of the core principles around wiring up subscriptions, including: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to standardize the casing - I vote "Urql". Capitalized (proper noun) and not as spammy/agressive as URQL.
Not something for this pr, but worth us thinking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all of the markdown of our docs we've now gone with "urql" (also when possible stylised as monospaced) which was discussed on Slack.
We can reopen that discussion, but frankly I think optically "urql" is fine and works well, "Urql" is OK but would now be an inconsistency given the docs, and "URQL" would be highly inconsistent and also doesn't read rather nicely (definitely shouty)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My issue with all lowercase is that there's not much emphasis on the name which leaves it feeling a little deflated. We can highlight the name in markdown which is awesome but in other places such as a tweet, the name urql just gets lost amongst the words.
Sounds like all lowercase is the standard for now so let's go with that. Maybe there are other examples of all lowercase being used for branding? If you find any forward them to me!
integrity sha512-s0nGPVbbA9a0FhUarNJino4i1J1UyQ5rGA1MmA65U/+xUXmBQEw4cCKceRXkDhgL8ZJ2HVhvxthHFZZTf02gBA== | ||
dependencies: | ||
bs-rebel "^0.2.3" | ||
wonka@^3.0.0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like our lock file was out of sync with our package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just for the example project, so not too concerned about it for the time being. I verified the example starts up as expected 👍
@JoviDeCroock yep, the change for |
I looked over it, my bad |
@parkerziegler seems to be working now. Just a failing snapshot; not sure what happened there but the stack might be inaccurate? I've got an alternative implementation for that since we're launching devtools soon and want that to be super nice and accurate 👍 |
cc/ @kitten @andyrichardson @JoviDeCroock merging this with the snapshots updated to pass the build. When #329 gets merged we can update those snapshots in tests. |
This PR would fix #319. As @mjadczak points out, the
void
type is a mistake there -handler
is called inuseSubscription
with(s.data, data)
, wheres.data
is set initially byuseImmediateState
toundefined
: https://github.com/FormidableLabs/urql/blob/master/src/hooks/useSubscription.ts#L36. It also fixes the signature of the mutable ref inside ofuseRequest
, which is initialized toundefined
.I'm also not sure if we were attempting to take advantage of
undefined
andnull
being sub-types ofvoid
, so feel free to push back on this change (but it seems to make sense to me).