Our plans for this were to add priorities to packages. There is a small description on the AMP Implementation Proposal: AMP package - #10 by luisherranz
What I am wondering lately is at which level we should add priorities:
- At a package level.
- At a function level.
For some of the things, like Html2React processors and Source handlers, we have defined them at a function level. It’s more complex, much also more versatile.
WordPress also has them at a function level for actions (add_action
) and filters (add_filter
).
We should start a conversation about this
The code you mention will work because app
is exposed in ctx
.
However, I think our recommendation should be to use a normal Frontity middleware, as described in this IP, and await for next()
when you need to run something after the SSR.
You are right. Most of the time, when the rendering should be skipped, it would be enough to not call next()
.
I wonder if there will be sometimes when skipping the React SSR AND keep executing the rest of the middleware (from other packages) will be necessary.
I guess it’s better to wait until we see more real usage of this
By the way, the API you describe is not required for this. "Not calling next()
" is possible with the normal Frontity middleware functions described in this IP.
Awesome, thanks!
Yes, we will have to change that when we work in this implementation.
If you read my IP draft, that was one of the options explained there (section C). It included the pros and cons of not only that approach but also the alternatives: Server Extensibility - #13 by luisherranz.
It’s not too late to change some parts of the IP, so if you have a strong opinion about that specific part or any other, or you want to point out additional pros/cons of each approach that were not reflected in that draft, please do so