Giter VIP home page Giter VIP logo

Comments (10)

brandondurham avatar brandondurham commented on June 4, 2024 2

Unsubscribing listeners didn’t do the trick for me. I actually removed them altogether and still get the warning in my tests, and occasionally in the browser.

from react-flickity-component.

nullhook avatar nullhook commented on June 4, 2024 1

This error occurred to me when I didn't cleanup a listener after unmount. The fix is to unbind any events you're registering on unmount.

React.useEffect(() => {
    const listener = () => {
      const text = flkty.current.selectedElement.getAttribute('data-caption');
      setCaption(text);
    };

    flkty.current.on('select', listener);

    return () => flkty.current.off('select', listener);
}, []);

from react-flickity-component.

rafaelcorreiapoli avatar rafaelcorreiapoli commented on June 4, 2024

Im also having this issue

from react-flickity-component.

yaodingyd avatar yaodingyd commented on June 4, 2024

Can you create a reduced test case in codesandbox?

from react-flickity-component.

guille-alibrate avatar guille-alibrate commented on June 4, 2024

It's still happening. You can check it using your own demo:

See:
https://codesandbox.io/s/qlz12m4oj6

Just change the library version from 3.2.0 to 3.4.0. And check the (chrome) console.

https://codesandbox.io/s/react-flickity-94qi9

Apparently, it's working with 3.3.2, so I'll stick to it.

from react-flickity-component.

howells avatar howells commented on June 4, 2024

Has anyone been able to fix this?

from react-flickity-component.

yaodingyd avatar yaodingyd commented on June 4, 2024

Have you try the latest version? you need to install flickty as peer dependency

from react-flickity-component.

howells avatar howells commented on June 4, 2024

@nullhook ah! I didn't consider that because I was using the on attribute as part of Flickity options, so I've reconfigured it and I don't seem to be getting the error anymore. Thank you.

from react-flickity-component.

haase1020 avatar haase1020 commented on June 4, 2024

I am not sure why this case is closed... I am still running into the same issue even though I am cleaning up the listener in my useEffect after unmounting. Any suggestions on how to troubleshoot?

from react-flickity-component.

nullhook avatar nullhook commented on June 4, 2024

ensure you're component is properly unmounted - try logging from the unmount function and see if it triggers on unmount. also, it depends on how you're defining flickityRef - ensure the local reference to the Flickity component isn't null.

from react-flickity-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.