Coder Social home page Coder Social logo

Comments (4)

dagnelies avatar dagnelies commented on July 28, 2024

I'm not very familiar with nextjs and your project. I can just say that isAvailable() is meant to be called at runtimevin the browser (to discover the browser/platform capabilities). It is not something to be called server-side and pre-rendered. So of course the window object is necessary at that point. The issue as far as I understand is unrelated to this library but because you use isAvailable() to pre-render server side. Feel free to reopen the issue if I missed something.

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

...that goes for all the webauthn.client.* stuff of course. It's for the browser at runtime, not for server side rendering.

from webauthn.

erickriva avatar erickriva commented on July 28, 2024

vercel/next.js#47028 (comment)
Searching for similar discussions, I've found this sentence: "Client components are rendered on the server too.". Therefore, window is undefined in first render.

To solve it on Next project, there's need for a useState and a useEffect, adding complexity to codebase to every component where this lib is called.

Can't this lib check for typeof window !== undefined before to do what's necessary? Obviously, if complexity don't increase as much as I mentioned.

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

Without window, the lib obviously cannot check if WebAuthn is available for that browser. It doesn't even make sense.

from webauthn.

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.