ardatan / ardatan/stencil-apollo
QueryResult refetch
- Dominant language
- TypeScript
- Stars
- 98
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to implement `refetch` on the query result, but I am not successful.
With an adapted standard example:
```tsx
{({ data, loading, refetch }) => {
if (loading) return "Loading...";
return (
-
{post.title} by {post.author.firstName}{" "}
{post.author.lastName} ({post.votes} votes){" "}
{this.renderUpvoteButton(post.id)}
{data["posts"].map(post => (
))}
refetch()}>Refetch
);
}}
```
I get the error:
```
TypeError: refetch is not a function. (In 'refetch()', 'refetch' is undefined)
```
Any ideas on how to get this working?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the Query component and QueryResult implementation used by the adapted Apollo example, then trace which values are passed to the render prop. Reproduce the TypeError from the shown onClick handler and compare the available result API with Apollo's expected refetch behavior. Done means the example exposes a callable refetch function that updates the query result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100