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

FIX: Fully re-render ads when navigating between pages #188

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

davidtaylorhq
Copy link
Member

In the past, the ad plugin relied on two side-effects to achieve this behaviour:

  1. Components being fully destroyed/rendered when navigating between pages. This stopped working when Discourse core moved to the more efficient 'loading slider' UI

  2. The listLoading argument. This was an implementation detail of the old discovery routing infrastructure. Core recently overhauled this and removed the listLoading argument, because loading is now handled properly by the Ember router.

Instead of these two properties, we can use the currentRoute property of Ember's router service to trigger changes when navigating between pages. A common {{#each trick is used to fully destroy/re-render components even if the ad network is unchanged.

@davidtaylorhq davidtaylorhq force-pushed the render-glimmer branch 2 times, most recently from bf6210a to bed5d23 Compare November 7, 2023 18:25
Base automatically changed from render-glimmer to main November 7, 2023 18:37
In the past, the ad plugin relied on two side-effects to achieve this behaviour:

1. Components being fully destroyed/rendered when navigating between pages. This stopped working when Discourse core moved to the more efficient 'loading slider' UI

2. The `listLoading` argument. This was an implementation detail of the old discovery routing infrastructure. Core recently overhauled this and removed the `listLoading` argument, because loading is now handled properly by the Ember router.

Instead of these two properties, we can use the `currentRoute` property of Ember's router service to trigger changes when navigating between pages. A common `{{#each` trick is used to fully destroy/re-render components even if the ad network is unchanged.
@davidtaylorhq davidtaylorhq marked this pull request as ready for review November 7, 2023 19:46
@davidtaylorhq davidtaylorhq merged commit c88bb59 into main Nov 7, 2023
5 checks passed
@davidtaylorhq davidtaylorhq deleted the re-render-ads branch November 7, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants