GithubHelp home page GithubHelp logo

Comments (2)

quisido avatar quisido commented on June 14, 2024

I have not seen this error before, so I am not sure without a minimal reproduction. My guess is that your Component re-rendering is attempting to set the clipboard.

Setting the clipboard causes a re-render, because the first parameter of useClippy is the current clipboard value.

If you are setting the clipboard on render, this can trigger an infinite loop. This error may be Chrome bailing out of that loop.

Potential areas of interest:
On line 115, we execute the copy command: https://github.com/CharlesStover/use-clippy/blob/master/src/use-clippy.ts#L115
On line 141, we listen for the copy event and rerender when it occurs: https://github.com/CharlesStover/use-clippy/blob/master/src/use-clippy.ts#L141
On line 177, we execute the copy command and also re-render: https://github.com/CharlesStover/use-clippy/blob/master/src/use-clippy.ts#L177

While this, at worst, should just result in two re-renders instead of one, there may be funky logic here that causes Chrome to think the clipboard is being accessed too frequently.

I would first investigate that you aren't just setting the clipboard on each render.

from use-clippy.

sangdth avatar sangdth commented on June 14, 2024

Thanks for your response, I don't have time to investigate deeper, I'm using another similar hook from react-use package and it works ok now.

from use-clippy.

Related Issues (19)

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.