Add prerender pipeline hooks for better extensibility #1628

Closed
opened 2025-08-09 17:21:00 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @laskoviymishka on 5/9/2016

This need some design, so i address it to @SteveSandersonMS, if you good with such approach i could implement this.
So for better extensability it will be realy nice to have some pipeline injects to manage some additional variables passing from asp.net server directly to server JS (like some auth info beside cookie, or may be initial state of Redux store, so we don't have to grab it from web api via additional http requests).
For example there is could be some PrerenderOptions class which could be extended via calling AddPrerender method in ConfigureServices method of application startup class. This method just register some hepler interface to run prerender manually and setup prerender opions.
This options could be something like

 public class PrerenderOptions
 {
        public Action<Request, NodeInvocationInfo> BeforeRenderModule{ get; set; }

        public NodeServicesOptions() {
            this.HostingModel = _ => { };
        }
 }

Inside on NodeInvocationInfo options already Args[] property which passing directly to the JS Module invocation, so we could push anything to our JS code from server via this hook.

This is kinda realted to issue #66 (both require prerry much same refactoring, to establish clearer pipeline for prerendering process).

*Originally created by @laskoviymishka on 5/9/2016* This need some design, so i address it to @SteveSandersonMS, if you good with such approach i could implement this. So for better extensability it will be realy nice to have some pipeline injects to manage some additional variables passing from asp.net server directly to server JS (like some auth info beside cookie, or may be initial state of Redux store, so we don't have to grab it from web api via additional http requests). For example there is could be some `PrerenderOptions` class which could be extended via calling `AddPrerender` method in `ConfigureServices` method of application startup class. This method just register some hepler interface to run prerender manually and setup prerender opions. This options could be something like ``` public class PrerenderOptions { public Action<Request, NodeInvocationInfo> BeforeRenderModule{ get; set; } public NodeServicesOptions() { this.HostingModel = _ => { }; } } ``` Inside on `NodeInvocationInfo` options already `Args[]` property which passing directly to the JS Module invocation, so we could push anything to our JS code from server via this hook. This is kinda realted to issue #66 (both require prerry much same refactoring, to establish clearer pipeline for prerendering process).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1628
No description provided.