-
Notifications
You must be signed in to change notification settings - Fork 4
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
Initialization Actions are Handled Multiple Times by Original Reducer When Using Lazy/Suspense #15
Comments
I've updated the unit tests and created an integration test, they all fail to reproduce the issue. I found out that the problem occurs only when Bricks are lazy-loaded using React.lazy and Suspense. If I load the sidebar elements in Next Gen MOTOR-TALK without lazy/suspense, the INIT_REFRESHABLE_AD_PLACEMENT is handled only once by the reducer, as it should. |
👷🏻♀️ TODO – write another integration test that uses lazy/suspense that reproduces the issue |
…actions only once Change-Id: I9d4dc8d803372249df46b21b7feb57a89d783acf
…eset the mocks – d'oh! Change-Id: If89f8c79a05eb28020b6e7ed75ad5516a9a00a14
Change-Id: Ia96ded6f96505f05ae6fd5076954262715eb2f68
In the Next Gen MOTOR-TALK app, an action INIT_REFRESHABLE_AD_PLACEMENT is dispatched when the RefreshableAd component has been mounted.
The original reducer of the app handles this action to set a timestamp that allows us to refresh the ad slot when the pagination is used (see Jira ticket PLY-711).
When we use withBrick or withBricks from modular-toolkit/bricks to dynamically install bricks to the application, the original reducer is replaced with a new one that includes the reducers of the bricks.
Next Gen MOTOR-TALK uses this to lazy-load the three sidebar elements “Board Info”, “Board Facilitators” and “FAQ”.
The enhanced reducer handles the INIT_REFRESHABLE_AD_PLACEMENT action four times, presumably once for the original reducer and once for each of the three installed bricks.
This causes the ad creatives for the sidebar rectangle, left skyscraper and right skyscraper to be requested from the DFP ad server four times each.
Subsequent actions, e.g. REFRESH_AD_PLACEMENT are handled by the reducer correctly, i.e. only once.
The text was updated successfully, but these errors were encountered: