Skip to content
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

Merged
merged 2 commits into from
Jul 8, 2019

Conversation

parkerziegler
Copy link
Contributor

This PR would fix #319. As @mjadczak points out, the void type is a mistake there - handler is called in useSubscription with (s.data, data), where s.data is set initially by useImmediateState to undefined: https://github.com/FormidableLabs/urql/blob/master/src/hooks/useSubscription.ts#L36. It also fixes the signature of the mutable ref inside of useRequest, which is initialized to undefined .

I'm also not sure if we were attempting to take advantage of undefined and null being sub-types of void, so feel free to push back on this change (but it seems to make sense to me).

@andyrichardson
Copy link
Contributor

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;
}

Copy link
Collaborator

@JoviDeCroock JoviDeCroock left a 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:
Copy link
Contributor

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.

Copy link
Member

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)

Copy link
Contributor

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:
Copy link
Contributor

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

Copy link
Contributor Author

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 👍

@parkerziegler
Copy link
Contributor Author

@JoviDeCroock yep, the change for useRequest was included as well, it's at the very bottom of the diff 👍

@JoviDeCroock
Copy link
Collaborator

@JoviDeCroock yep, the change for useRequest was included as well, it's at the very bottom of the diff 👍

I looked over it, my bad

@parkerziegler
Copy link
Contributor Author

parkerziegler commented Jul 2, 2019

Looks like Sail CI may be down?

image

@kitten
Copy link
Member

kitten commented Jul 2, 2019

@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 👍

@parkerziegler
Copy link
Contributor Author

@kitten do you want me to merge this and we'll assume that #329 will fix the build once it gets merged? Or wait until #329 is merged, rebase off of it, and then merge?

@parkerziegler
Copy link
Contributor Author

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.

@parkerziegler parkerziegler merged commit 8405ac2 into master Jul 8, 2019
@parkerziegler parkerziegler deleted the task/319-fix-subscription-handler-signature branch July 8, 2019 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SubscriptionHandler type issue
4 participants