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

autoReload creating new slot with original slot information. #157

Open
rosspbauer opened this issue Jul 24, 2019 · 2 comments
Open

autoReload creating new slot with original slot information. #157

rosspbauer opened this issue Jul 24, 2019 · 2 comments
Labels

Comments

@rosspbauer
Copy link

Im setting up the DFPSlotsProvider with the autoReload prop set to { adUnit: true, targetingArguments: true}

  <DFPSlotsProvider
   dfpNetworkId='1111'
   adUnit={ this.props.adPath }
   autoReload={{ adUnit: true, targetingArguments: true}}
   targetingArguments={ this.props.targets }
  >

My expectation here is that when the prop values for the adUnit and targetingArguments changed the ads would be reloaded with the new prop values.

What appears to happen is the original slots are destroyed and new ones are created with the values for the original slot that was generated (located in the registeredSlots object in the manager). Therefore the targeting of the new ads is not representative of the current set of props.

Is this behaviour expected / a bug? and is there a way to reload the slots with the updated information?

Thanks

@jaanauati
Copy link
Owner

Hi, you are right, as described in the doc autoReload will call DFPmanager.reload() under the hood, so the ads will be destroyed and created again:

http://react-dfp.ml/dfpslotsprovider/autoreload/
http://react-dfp.ml/dfpmanager/reload/

On the other hand, the behavior you expect can be achieved by calling the method DFPManger.refresh(): http://react-dfp.ml/dfpmanager/refresh/. There is one issue though, just checked the code real quick and I think DFPSlotsProviding is not re-rendering when updating the targetingArguments prop, so given we pass targeting attributes via context the AdSlots are not gonna be updated w the new targeting variables (https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L222, https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L98, https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L144).
This is a bug and we'll need a pull request to get it fixed, as a workaround i'd suggest you to programmatically call DFPManager.setTargetingArguments(...) and DFPManager.refresh() to update targeting arguments and refresh all the slots in the page:

http://react-dfp.ml/dfpmanager/settargetingarguments/
http://react-dfp.ml/dfpmanager/refresh/

I'll keep this ticket opened until we can the bug fixed, please let me know if the workaround worked for you.

thanks

@jaanauati jaanauati added the bug label Jul 26, 2019
@daraclare
Copy link
Contributor

daraclare commented Mar 24, 2021

Hi @jaanauati looks like this issue with DFPSlotsProviding not re-rendering when updating the targetingArguments prop is still happening, so none of the targeting arguments are updating. The workaround is not working for me, do you know if the DFPSlotsProviding was ever re-rendering / working as expected? I tried to use version 0.10.0, but the issue seems to be the same. I had a quick look and it seems the context is updating correctly.

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

No branches or pull requests

3 participants