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

Remove query #10

Closed
wants to merge 5 commits into from
Closed

Remove query #10

wants to merge 5 commits into from

Conversation

smkhalsa
Copy link
Member

per #9, this PR removes the Query widget in favor of using StreamBuilder directly. This change narrows the API without losing core functionality and allows us to remove the Flutter dependency.

QueryRequest also now implements Request from gql_exec.

@smkhalsa smkhalsa requested a review from klavs February 25, 2020 16:16
Copy link

@klavs klavs 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.

As a thought experiment (and a bit of a stretch), what if there was no QueryRequest and it's config was just a class FerryContext extends ContextEntry?

  • request.withContextEntry<OptimisticResponse>(...)

(I'm not saying it's necessary, or even a good idea)

With Dart extension members it could become request.withOptimisticResponse(...)

@smkhalsa
Copy link
Member Author

As a thought experiment (and a bit of a stretch), what if there was no QueryRequest and it's config was just a class FerryContext extends ContextEntry?

Interesting idea!

In this case, queryController could simply be a stream of Query instead of QueryRequest<T>. I'm not sure how we'd deal with QueryRequest<T> generics since we filter by type in responseStream.

@smkhalsa
Copy link
Member Author

After digging deeper on this, I'm going to hold off on removing the Query Widget for now.

Even with the equality override on QueryRequest, the StreamBuilder will constantly rebuild since calling client.responseStream(MyQuery()) will still return a unique Stream object each time.

I've thought about some workarounds, but I think it's easier just to maintain the Query widget for now.

Some of the other changes in this PR have been incorporated into #11.

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.

2 participants