Comment on page
Set up Hypertune
Define a new feature flag called
showNewEditor
on the Root
type:type Root {
exampleFlag: Boolean!
showNewEditor: Boolean!
}
Switch to the Logic tab and select the new "Show New Editor" flag.
Add an "If / Else" expression with a rule that enables the flag if
context > user > id
is test_id
and disables it by default.Switch to the Preview tab and enter the following query:
query TestQuery {
root {
showNewEditor
}
}
Hypertune uses GraphQL for its query language. In the Result tab, you can see the flag that matches your query, including all of its logic.
Now pass the
context
argument containing the user
object in the query:query TestQuery {
root(
context: {
user: {
id: "test_id"
name: "Test"
email: "[email protected]"
}
}
) {
showNewEditor
}
}
Now your flag logic has been reduced, i.e. the "If / Else" expression has been replaced with its result. Try entering different user IDs to see how the result changes.
Click "Save and activate" in the navigation bar.
Follow one of the quickstarts below to get feature flags in your code:
Last modified 17d ago