The only reference to preboot in this repo is in the package.config file. Is preboot expected to work?
For me it shows the prerendered version for a while, and I can't click on anything. And after that the whole page is reloaded and then I can click.
I have tried following these steps https://github.com/angular/preboot#preboot with no luck.
Have anyone else manged to implement preboot?
@MarkPieszak Sorry to disturb you but is preboot supposed to work?
@Flood Hey apologies for the delay, I haven't tried the latest, but let me talk to Jeff and see if there's anything else I need to configure to get it to work. It might be something else I'm doing that's causing it not to work.
@MarkPieszak Do you have any updates?
I'll take a look at adding it myself this afternoon and get right back to you!
In the expressEngine they pass preboot: true in IEngineOptions. In the aspnetcore-engine that property is missing. Not sure if the JavaScriptService in Core supports it?
No updates yet @MarkPieszak? Can't figure out how to solve this by my self. Have you talked to Jeff?
Ok, wow that took a while, but I figured it out. 馃憤
Since we're taking over the entire html I didn't have it configured to pass down <script>'s from inside the <head>. So basically the script that preboot was creating from all the events it tracked etc wasn't getting fired, since when it tried to fire it - nothing was there :)
Just made a PR #401
Magic! Thank you :) 馃
@MarkPieszak It seems to be some errors still. If you try throttling and types something in the input field (server version), then when preboot is finished is breaks in the console. Same if you click on the counter server version.
Uncaught ReferenceError: vendor_b14c0a696db3423be7da is not defined
It doesn't break in the console anymore, must have been some webpack glitch.
It still doesn't replay any events though. Try throttle the network and click increment/type in input. When CSR loads, the counter is still zero and the input field gets empty.
Did you rebuild vendor and all other webpack files ?
Yes, I've cloned a new repo and tried. Does it really work for you? Can you type in the input field or click the counter and it gets replayed?
When I type in an input yes, I tested it by throttling the network speed to Fast 3G, I didn't try clicking on a Counter or anything though, might need to manually tell it to listen to click events on type button?
// This is from the preboot docs
// Here are some examples of event selectors from the defaults:
var eventSelectors = [
// for recording changes in form elements
{ selector: 'input,textarea', events: ['keypress', 'keyup', 'keydown', 'input', 'change'] },
{ selector: 'select,option', events: ['change'] },
// when user hits return button in an input box
{ selector: 'input', events: ['keyup'], preventDefault: true, keyCodes: [13], freeze: true },
// when user submit form (press enter, click on button/input[type="submit"])
{ selector: 'form', events: ['submit'], preventDefault: true, freeze: true },
// for tracking focus (no need to replay)
{ selector: 'input,textarea', events: ['focusin', 'focusout', 'mousedown', 'mouseup'], noReplay: true },
// user clicks on a button
{ selector: 'button', events: ['click'], preventDefault: true, freeze: true }
];
Currently dealing with the hurricane so sorry I can't help much further right now. Will probably be MIA next few days!
Hmm weird, it started to work (both input and counter) without any changes. Must have been some caching issues. So nvm :)