Skip to content

Commit 876a39b

Browse files
Add query preprocessing skip guide
1 parent 5fa33a6 commit 876a39b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ Since our queries are slim now, we can switch back to HTTP GET, you can find a [
8686

8787
[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.
8888

89+
It is possible to skip some parts of the query lifecycle for cases when query is persisted—read more [here](docs/skip_query_preprocessing).
90+
8991
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).
9092

9193
> 📖 Read more about the gem internals: [Persisted queries in GraphQL:

docs/skip_query_preprocessing.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Skipping some preprocessing steps
2+
3+
It does not make much sense to revalidate persisted query—we did it earlier, so it can be disabled in the `#execute` call:
4+
5+
```ruby
6+
GraphqlSchema.execute(
7+
params[:query],
8+
variables: ensure_hash(params[:variables]),
9+
context: {
10+
extensions: ensure_hash(params[:extensions])
11+
},
12+
operation_name: params[:operationName],
13+
validate: params[:query].present?
14+
)
15+
```
16+
17+
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 commit comments

Comments
 (0)