I have a service that fetches data from headless CMS Cockpit in my Angular app. I am using Scully to prerender my pages. It works great in doing the prerender, it fetches content build time and creates a static page, however when opening page, Angular loads that data again, although it should come from some kind of scully context.
How to prevent Angular from loading content in runtime when it was already prerendered by Scully?
735 Views Asked by Blind Despair At
1
There are 1 best solutions below
Related Questions in ANGULAR
- Firebase link existing user to anonymous account?
- It doesnt always show all the books on my homepage
- Google adsense ads.txt status cannot be not found
- When I navigate to the URL'http://localhost:4200/', it redirects me back
- Ionic Angular Standalone ion-icon are not showing at all
- How to make Angular understand that view child is of a specific type, not a general ElementRef?
- vscode, debug angular, first time, doesn't debug, 2nd time stops at main.js then it's ok
- How to perform CRUD operations on a static JSON array in Angular? (without API)
- Ngrx props<>() method in createAction()
- How to animate rotation of an image inside input control?
- Detecting click inside and outside of the listening component in Angular
- Angular - type guard not narrowing types
- In node_modules file i am getting Angular genric error while using fontawesome in angular12
- Angular 16 sending null values to API
- GoogleCloud Error: Not Found The requested URL was not found on this server
Related Questions in ANGULAR-SCULLY
- Particle JS is not working with SSR (Server Side Rendering) Angular and Scully
- Rendering dynamic routes in AnalogJS without using a prefix or a folder?
- Running Scully in an Angular 15 Project?
- Scully.io Prerenders only ROOT route as static file but does not prerender ANY other routes
- Scully (Puppeteer) can't find browser. But the neigbhor project with the same configs working well
- Issue with Angular pre-rendering with universal & Scully for SEO
- Can't deploy Scully (Angular) app on AWS: 502 Bad Gateway
- No scully configuration file found scully.undefined.config.ts Path "/scully.undefined.config.ts" does not exist
- handleUnknownRoute using a subdirectory with Scully
- Scully prerender - Cannot GET dynamic route
- How scully decides when to render a member variable into HTML?
- Angular PreRender hide parts
- Scully static server won't serve urls with percent-encoded space
- Type 'Subscription' is missing the following properties from type 'Subscription': _parentOrParents, _subscriptions
- Putting extraRoutes in separate file for multiple configuration in Scully results in importerror
Related Questions in SCULLY
- Config file doesn't create after installation of scully
- Particle JS is not working with SSR (Server Side Rendering) Angular and Scully
- Scully: Error during file write Error: ENOENT: no such file or directory, mkdir
- Angular: Scully plugin fetching routes from Angularfire firestore service, fails with error Error [ERR_REQUIRE_ESM]: require() of ES not supported
- Running Scully in an Angular 15 Project?
- Scully.io Prerenders only ROOT route as static file but does not prerender ANY other routes
- Scully (Puppeteer) can't find browser. But the neigbhor project with the same configs working well
- Scully with Angular not generating html pages with the correct content (also no meta tags)
- Issue with Angular pre-rendering with universal & Scully for SEO
- Scully install fails with Puppeteer renderer
- ng add @scullyio/init acts like it's fine in terminal until I choose Puppeteer
- Can't deploy Scully (Angular) app on AWS: 502 Bad Gateway
- No scully configuration file found scully.undefined.config.ts Path "/scully.undefined.config.ts" does not exist
- handleUnknownRoute using a subdirectory with Scully
- Routes with trailing slash - Angular
Related Questions in SCULLYIO
- Scully.io Prerenders only ROOT route as static file but does not prerender ANY other routes
- Scully (Puppeteer) can't find browser. But the neigbhor project with the same configs working well
- Issue with Angular pre-rendering with universal & Scully for SEO
- Scully isn't generating config.ts file in Angular project
- No scully configuration file found scully.undefined.config.ts Path "/scully.undefined.config.ts" does not exist
- handleUnknownRoute using a subdirectory with Scully
- Scully prerender - Cannot GET dynamic route
- How scully decides when to render a member variable into HTML?
- Scully static server won't serve urls with percent-encoded space
- Putting extraRoutes in separate file for multiple configuration in Scully results in importerror
- Scullyio - How to get Angular Material theme(CSS) also to be rendered in the Static Index.html file after build?
- Basic Angular ng
- Using web components with Scully?
- Telling Scully to Ignore Static Page Generation for a Route?
- Deploy Scully Static Folder with angular-cli-ghpages?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
After looking at the source code of scully I managed to find a useful service there:
TransferStateService. So I modified my service to use to my advantage in my service that fetches data from Cockpit:So when scully is running we fetch data and with a side effect use
TransferStateServiceto set data on the page. Otherwise when it's already a generated page we just get that data back from page instead of doing another request. Then any endpoint can just call this method like:So when loading data using service all my components will receive correct data with the same interface and internally it handles the source of where data comes from.
Important note here: make sure you also have
IdleMonitorServiceinjected somewhere, e.g. in AppModule like so:If
IdleMonitorServiceis not injected anywhere Angular never creates its instance and scully is not able to track when angular becomes idle during prerender, which results in much longer build time and also it will misswindow['ScullyIO']being set to'generated', soisScullyGenerated()will always returnfalsein runtime.EDIT: as of version 0.0.15 of
@scullyio/ng-libIdleMonitorServiceno longer needs to be injected inAppModule, now it only requires to importScullyLibModuleinstead.