Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showcase: bug with lazy loaded demo-ui module and @ngrx/store-devtools/recompute #1175

Open
SuperITMan opened this issue Mar 7, 2019 · 2 comments

Comments

@SuperITMan
Copy link
Member

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

In the showcase application, when we open a page component from the demo-ui module, it is really slow due to lots of action recompute (more than 30 times)

action @ 10:06:47.322 @ngrx/store-devtools/recompute (in 0.20 ms)
main.427cd2a0a19249ced88e.js:1  prev state {StarkLogging: {…}, StarkSession: {…}, StarkSettings: {…}, StarkMessages: {…}, StarkProgressIndicator: {…}, …}
main.427cd2a0a19249ced88e.js:1  action {type: "@ngrx/store-devtools/recompute"}
main.427cd2a0a19249ced88e.js:1  next state {StarkLogging: {…}, StarkSession: {…}, StarkSettings: {…}, StarkMessages: {…}, StarkProgressIndicator: {…}, …}

It's due to the reducer StoreModule.forFeature("MovieSearch", movieSearchReducers) added in the demo-ui module for the Generic Search component.

Expected behavior

The showcase should not be slowed down due to

Minimal reproduction of the problem with instructions

Go on https://stark.nbb.be/showcase/latest/home, open the console and then go on Stark UI > Components > Action bar then look at the console.

What is the motivation / use case for changing the behavior?

Fix the showcase.

Environment


Angular version: 7.2.8
Stark version: 10.0.0-beta.5

@christophercr
Copy link
Collaborator

christophercr commented Mar 12, 2019

I've had a look on this issue and indeed the store-devtools triggers the @ngrx/store-devtools/recompute action 50 times at most. Why 50? Because we have configured the store-devtools to keep the last 50 dispatched actions in the history tree so we can debug such actions (replay, skip, etc...). So whenever a lazy loaded module is loaded, all the actions in the history are "recomputed".

However the slowdown issue is not related to the X number of times that the @ngrx/store-devtools/recompute action is dispatched. The delay is due to the loading of lazy loaded modules in DEV which is a lot slower than in PROD. By enabling AOT in the development build the delay decreases considerably and it is almost the same as in production.

Unfortunately, we cannot enable AOT in dev at this moment because an error is thrown after the first rebuild when a file is changed:

ERROR in Debug Failure. False expression: Host should not return a redirect source file from `getSourceFile`

This is a known bug in Angular: angular/angular#22524

Maybe we could try the solution mentioned in one comment of that issue about adding some paths in the tsconfig.json file.

@SuperITMan SuperITMan added this to the 10.0.0-rc.1 milestone Jun 6, 2019
@SuperITMan
Copy link
Member Author

Apparently, this issue has been fixed in Angular 8, see angular/angular@3166cff.
Since it's not a blocking issue, we could wait for Stark 11.0.0 with Angular 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants