Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: KijijiCA/react-advertising
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.2.14
Choose a base ref
...
head repository: KijijiCA/react-advertising
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.2.15
Choose a head ref
  • 2 commits
  • 5 files changed
  • 3 contributors

Commits on Jan 2, 2025

  1. fix: googletag.display errors when ad slot not in DOM (#142)

    ## Description
    This PR fixes an issue where GPT complains if googletag.displaySlots()
    is called for a defined ad slot that is not yet in the DOM, i.e.
    ```
    GPT] Error in googletag.display: could not find div with id "my-ad-id" in DOM for slot: /my/ad/unit/path
    ``` 
    
    - The fix is to defer the calling of `Advertising.displaySlots()`. So
    instead calling this method in `Advertising.setupGpt()`, we are now
    calling it at the end of `Advertising.active()`.
    - I've also refactored displaySlots() to accept an id and to only call
    `window.googletag.display(id)` for this single `id`, instead of
    iterating through all the slots
    - `Advertising.active()` gets called from the `AdvertisingSlot`
    component, so now Advertising.displaySlots() will not fire for defined
    ad slots that are not yet in the DOM.
    - The solution was based on a suggestion from @Trav84, as outlined in:
    https://github.com/orgs/KijijiCA/discussions/141
    
    ---------
    
    Co-authored-by: Stephen Gill <stephen.gill@adevinta.com>
    caffeinated-pixels and Stephen Gill authored Jan 2, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3e9615b View commit details
  2. chore(release): 4.2.15 [skip ci]

    ## [4.2.15](v4.2.14...v4.2.15) (2025-01-02)
    
    ### Bug Fixes
    
    * googletag.display errors when ad slot not in DOM ([#142](#142)) ([3e9615b](3e9615b))
    semantic-release-bot committed Jan 2, 2025
    Copy the full SHA
    bebf598 View commit details
Loading