Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
75699238
Commit
75699238
authored
Dec 10, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply 2 suggestion(s) to 1 file(s)
parent
54007368
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
doc/development/api_graphql_styleguide.md
doc/development/api_graphql_styleguide.md
+9
-9
No files found.
doc/development/api_graphql_styleguide.md
View file @
75699238
...
@@ -785,7 +785,7 @@ end
...
@@ -785,7 +785,7 @@ end
You should never re-use resolvers directly. Resolvers have a complex life-cycle, with
You should never re-use resolvers directly. Resolvers have a complex life-cycle, with
authorization, readiness and resolution orchestrated by the framework, and at
authorization, readiness and resolution orchestrated by the framework, and at
each stage
lazy values
can be returned to take advantage of batching
each stage
[
lazy values
](
#laziness
)
can be returned to take advantage of batching
opportunities. Never instantiate a resolver or a mutation in application code.
opportunities. Never instantiate a resolver or a mutation in application code.
Instead, the units of code reuse are much the same as in the rest of the
Instead, the units of code reuse are much the same as in the rest of the
...
@@ -1705,16 +1705,16 @@ All client-facing changes **must** include a [changelog entry](changelog.md).
...
@@ -1705,16 +1705,16 @@ All client-facing changes **must** include a [changelog entry](changelog.md).
## Laziness
## Laziness
One important technique
for managing performance that is unique to GraphQL
is
One important technique
unique to GraphQL for managing performance
is
using
**lazy**
values.
These are values that
represent the promise of a result,
using
**lazy**
values.
Lazy values
represent the promise of a result,
allowing their action to be run later
. This
enables batching of queries in
allowing their action to be run later
, which
enables batching of queries in
different parts of the query tree. The main example of
thi
s in our code is
different parts of the query tree. The main example of
lazy value
s in our code is
the
[
GraphQL BatchLoader
](
graphql_guide/batchloader.md
)
.
the
[
GraphQL BatchLoader
](
graphql_guide/batchloader.md
)
.
If you need to manage lazy values directly, then please see
To manage lazy values directly, read
`Gitlab::Graphql::Lazy`
, and in
`Gitlab::Graphql::Lazy`
, and in particular
`Gitlab::Graphql::Laziness`
, which
particular
`Gitlab::Graphql::Laziness`
. This contains
`#force`
and
contains
`#force`
and
`#delay`
which help implement the basic operations of
`#delay`
, which help implement the basic operations of creation and
creation and
elimination of laziness, where needed.
elimination of laziness, where needed.
For dealing with lazy values without forcing them, use
For dealing with lazy values without forcing them, use
`Gitlab::Graphql::Lazy.with_value`
.
`Gitlab::Graphql::Lazy.with_value`
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment