Giter Club home page Giter Club logo

Comments (3)

Ashutosh-Bhadauriya avatar Ashutosh-Bhadauriya commented on June 13, 2024 1

Okay taking a look

from hanko.

Ashutosh-Bhadauriya avatar Ashutosh-Bhadauriya commented on June 13, 2024

Hey @shricodev dynamic import importing the component when using it, fixes this issue. Have you tried that

import dynamic from 'next/dynamic';
const HankoAuth = dynamic(() => import('@/components/HankoAuth'), { ssr: false })

export default function LoginPage() {
 return (
   <HankoAuth />
 );
}

You can also find it in the docs, it has been updated
https://docs.hanko.io/quickstarts/fullstack/next

from hanko.

shricodev avatar shricodev commented on June 13, 2024

@Ashutosh-Bhadauriya I have already tried dynamically importing the <Hanko-Auth> component, but it did not work either. I have mentioned it here.

After going through the issues section in this repo, I found a closed issue that addressed this error. I tried dynamic importing the modules as shown #1020 (comment). This did not fix it either, or perhaps I missed something.

This is the code that renders <HankoAuth /> and <HankoProfile />

import dynamic from "next/dynamic";
// This is imported dynamically to get rid of a hanko bug.
// ReferenceError: CustomEvent is not defined
const HankoAuth = dynamic(() => import("@/components/HankoAuth/HankoAuth"), {
  ssr: false,
});

export default function LoginPage() {
  return (
    <div className="flex min-h-screen items-center justify-center">
      <HankoAuth />
    </div>
  );
}
import dynamic from "next/dynamic";
import type { ComponentType } from "react";

// These are imported dynamically to get rid of a hanko bug.
// ReferenceError: CustomEvent is not defined
const HankoProfile = dynamic(
  () => import("@/components/HankoProfile/HankoProfile"),
  {
    ssr: false,
  },
);
import LogoutButton from "@/components/HankoLogout/LogoutBotton";

type Props = {};

const Page: ComponentType<Props> = (props) => {
  return (
    <div className="mx-auto flex w-fit flex-col justify-center space-y-6 px-6">
      <HankoProfile />
      <LogoutButton />
    </div>
  );
};

export default Page;

PS: I have also tried dynamic importing the <HankoLogout /> component. It didn't work.
Could you please try checking in the existing codebase that might be throwing this error even when everything is done as mentioned? I may have missed something\

https://github.com/shricodev/pdfwhisper-openai

from hanko.

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.