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

Ist there a way to re-run? #48

Open
mountbatt opened this issue Nov 16, 2023 · 2 comments
Open

Ist there a way to re-run? #48

mountbatt opened this issue Nov 16, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@mountbatt
Copy link

Hi,

i am loading some video portfolios via ajax on an wordpress theme. Is there a way to re-run the script to detect the that are new to the dom?

Thanks for your help!

Cheers
Tobias

@eistruhe
Copy link

+1 on this. Facing the exact same issue. Running a combination of

cc.reset();
cc.run(cookieConsentConfig);
manager.run(managerConfig);

on each dynamic page load works, but only if the user clicks the "Load once" button. Clicking "Don't ask again" breaks the script. This probably also has to do with the CookieConsent reset() function not being able to detect already executed scripts.

@orestbida orestbida added enhancement New feature or request and removed triage labels Apr 1, 2024
@icetee
Copy link

icetee commented May 5, 2024

I create the hotfix this issue. When a page change occurs in react / next.js, it does not detect DOM changed. My solution reset and re-run iframemanager at each page change. PR #55

import { useRouter } from 'next/router'
...

useEffect(() => {
  // const cc = initCookieConsent()
  const im = iframemanager()
 
  setTimeout(() => {
      im.run(...)
  }, 1000) // Since it is not SSR, it is necessary to allow time for the client to render it

  return () => {
    im.reset() // stop observers, reset scoped variables
  }
}, [router.asPath])
...

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

No branches or pull requests

4 participants