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

Create reset function for re-render issues #55

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

icetee
Copy link
Contributor

@icetee icetee commented May 5, 2024

The plugin cannot detect DOM changes, indeed keeps the previous one. This is a clean solution that does not affect the expected operation. There are cases when you need to reset the entire script, this helps. #48

Example:

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])
...

Signed-off-by: Horváth Tamás András <htomy92@gmail.com>
@icetee icetee requested a review from orestbida as a code owner May 5, 2024 11:38
@icetee icetee mentioned this pull request May 5, 2024
Copy link

stale bot commented Jun 6, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 6, 2024
@stale stale bot closed this Jun 13, 2024
@orestbida orestbida reopened this Jun 14, 2024
@stale stale bot removed the stale label Jun 14, 2024
@orestbida orestbida added the enhancement New feature or request label Jun 14, 2024
theonlyriddle added a commit to GoThassos/iframemanager that referenced this pull request Aug 14, 2024
orestbida#55
Signed-off-by: Sebastian Riddle <sebastian@go-thassos.gr>
stopServiceObserver = {}
currLang = ''
services = {}
serviceNames = undefined

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using undefined causes some bugs. It should probably be best to set it to []

These lines in the script serviceNames.includes(serviceName) will throw errors

Co-authored-by: Orest Bida <dev@orestbida.com>
Signed-off-by: Orest Bida <dev@orestbida.com>
@orestbida orestbida merged commit b37a879 into orestbida:main Sep 8, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants