Skip to content

Commit 564d23f

Browse files
committed
Tweak blog post for Grafast audience
1 parent 996f9c1 commit 564d23f

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

Diff for: grafast/website/news/2025-03-24-grafast-0.1-beta.21.mdx

+30-25
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ this release, 3 of these are now complete!
2626
- ✅🎉 **Eradicating eval - this release!**
2727
- 🤔🔜 Polymorphism
2828

29-
After 3 months of gruelling work, we’re proud to announce that the third of
30-
these, eradicating eval, is now addressed with the launch of
31-
`[email protected]` (used as the core execution engine in
32-
29+
We’re proud to announce that the third of these, eradicating eval, is now
30+
addressed with the launch of `[email protected]`, and the approach has been
31+
fully adopted and tested via incorporation into `[email protected]`.
3332

3433
</p>
3534

@@ -38,7 +37,7 @@ these, eradicating eval, is now addressed with the launch of
3837
Since the beginning, Gra*fast* has had the ability to add plan resolvers not
3938
just to fields, not just to arguments, but also to input object fields
4039
(including those within lists). This made Gra*fast*’s planning really ergonomic
41-
for things like nested filters, which was great for PostGraphile! But it turns
40+
for things like nested filters. But it turns
4241
out it’s really problematic for certain shapes of input — planning would put
4342
constraints on the variables compatible with the plan, requiring potentially
4443
unlimited numbers of operation plans needing to be built for the same GraphQL
@@ -48,10 +47,10 @@ excessive time.
4847

4948
One particular user example that could cause 4 minutes of planning time from
5049
just a 100kB input made it clear that we had overreached with using plan
51-
resolvers too deep into inputs; so we’ve scaled it back so that you can only add
52-
plan resolvers to fields and arguments, you can no longer attach `applyPlan` or
53-
`inputPlan` to input object fields. This was something that we used a lot
54-
internally (hence the huge time investment migrating away!), but very few people
50+
resolvers too deep into inputs; so we’ve scaled it back so that you can only
51+
add plan resolvers to fields and arguments, you can no longer attach
52+
`applyPlan` or `inputPlan` to input object fields. This was something that we
53+
used a lot in PostGraphile and its various plugins, but very few people
5554
(no-one?) used externally so it was ripe for removal.
5655

5756
That problematic query that took 4 minutes to plan before? It now takes 1.1ms to
@@ -61,22 +60,23 @@ plan, yielding a 200,000x speedup!
6160

6261
### What does this mean for my codebase?
6362

64-
Hopefully good things! Please update to the latest `@beta` of all the
65-
PostGraphile and/or Gra*fast* related modules you’re using (including plugins)
66-
and for most users everything should work as before, only better.
63+
Hopefully good things! Please update to the latest `grafast@beta` and for most
64+
users everything should work as before, only better.
6765

68-
I’ve outlined some of the most common changes you may need to make below, but if
69-
you are impacted by any other changes, please ask for help in the chat — AFAIK
70-
most of the other things that have had significant changes are used by almost
71-
no-one except me, so it doesn’t make sense for me to invest time documenting it
72-
here. If you’re curious, many items are documented in both the changelogs and
66+
I’ve outlined some of the most common changes you may need to make below, but
67+
if you are impacted by any other changes, please ask for help [in the
68+
chat](https://discord.gg/graphile) — AFAIK most of the other things that have
69+
had significant changes are used by almost no-one except me, so it doesn’t make
70+
sense for me to invest time documenting it here since the software is still in
71+
beta. If you’re curious, many items are documented in both the changelogs and
7372
the pull requests where the changes occurred.
7473

7574
#### Change `fieldArgs.get` to `fieldArgs.getRaw`
7675

7776
Because we’ve removed `inputPlan`, the `fieldArgs.get(key)` method is no more;
7877
instead use `fieldArgs.getRaw(key)` which is equivalent unless the inputs had
79-
plans (which they cannot any more).
78+
plans (which they cannot any more). You'd know if you had plans on your inputs,
79+
it's very unlikely you did if you were writing your own Gra*fast* schema.
8080

8181
#### Converting `applyPlan` and `inputPlan`
8282

@@ -87,13 +87,13 @@ runtime application or transform of these inputs recursively via a single step
8787
in our plan diagram.
8888

8989
We’ve managed to make this new runtime system very similar in shape to the old
90-
plan-time system, so PostGraphile plugins don’t need to change much — this was
91-
largely enabled by how closely we managed to get the Gra*fast* plan syntax to the
92-
syntax of code you would normally write at runtime. The first change is to
93-
rename `applyPlan` to `apply`, and `inputPlan` to `baked`. From there, your code
94-
might just work straight away, or it might need some more small tweaks (e.g.
95-
`fieldArgs` is no longer present, it’s been replaced with simply the runtime
96-
value of the current field).
90+
plan-time system (largely enabled by how closely we managed to get the
91+
Gra*fast* plan syntax to the syntax of code you would normally write at
92+
runtime), so if you do need to transform any it shouldn't take much effort. The
93+
first change is to rename `applyPlan` to `apply`, and `inputPlan` to `baked`.
94+
From there, your code might just work straight away, or it might need some more
95+
small tweaks (e.g. `fieldArgs` is no longer present, it’s been replaced with
96+
simply the runtime value of the current field).
9797

9898
#### No more `$step.eval*()`
9999

@@ -102,6 +102,11 @@ you try and use them. They will likely be removed at some point after release,
102102
so you should be sure to migrate away from using them at your earliest
103103
opportunity. But you weren’t using them anyway… right?
104104

105+
If you were, a new `.apply()` pattern has been added to various steps to enable
106+
you to specify runtime tweaks the step can apply as its executing, for example
107+
changing the `ORDER BY` clause in an SQL query based on a variable argument.
108+
You may want to adopt a similar pattern in your own step classes.
109+
105110
#### ExecutableStep renamed to Step
106111

107112
This one is more cosmetic…

0 commit comments

Comments
 (0)