Skip to content

Commit

Permalink
Add query preprocessing skip guide
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryTsepelev committed Mar 24, 2023
1 parent 5fa33a6 commit 876a39b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Since our queries are slim now, we can switch back to HTTP GET, you can find a [

[persisted-queries-link](https://www.apollographql.com/docs/react/api/link/persisted-queries/) uses _SHA256_ for building hashes by default. Check out this [guide](docs/hash.md) if you want to override this behavior.

It is possible to skip some parts of the query lifecycle for cases when query is persisted—read more [here](docs/skip_query_preprocessing).

An experimental tracing feature can be enabled by setting `tracing: true` when configuring the plugin. Read more about this feature in the [Tracing guide](docs/tracing.md).

> 📖 Read more about the gem internals: [Persisted queries in GraphQL:
Expand Down
17 changes: 17 additions & 0 deletions docs/skip_query_preprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Skipping some preprocessing steps

It does not make much sense to revalidate persisted query—we did it earlier, so it can be disabled in the `#execute` call:

```ruby
GraphqlSchema.execute(
params[:query],
variables: ensure_hash(params[:variables]),
context: {
extensions: ensure_hash(params[:extensions])
},
operation_name: params[:operationName],
validate: params[:query].present?
)
```

Moreover, some analyzers can be disabled as well: in order to do that just pass the same check `params[:query].present?` to the context and then add early exit to your analyzers based on this flag.

0 comments on commit 876a39b

Please sign in to comment.