Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Client Side Rendering on Admin Components

default discord avatar
sithumd2 years ago
3

Hello everyone, I need customize the default dashboard for my project. So I am using apexcharts as my chart library. I made a separate react component for Dashboard and imported in config under admin.components.view.Dashboard. The issue I am facing is, apexcharts is not compiling because window object is undefined. So, How do I achieve client side rendering for my custom components? Thank You for your time.

  • discord user avatar
    jmikrut
    2 years ago

    so this is super strange



    apexcharts must be trying to do something immediately when it is loaded



    most react libraries won't do anything with the window until they are rendered, and in the browser... but here, it seems like by just importing the library, it's attempting to do something with the window



    so i'd structure your custom Dashboard component in a way that does not import apexcharts until it actually gets rendered



    you could do this with React Suspense or similar

  • default discord avatar
    sithumd2 years ago

    Thanks. I will try. ❤️‍🔥

  • default discord avatar
    techinverted2 years ago

    Hey

    @550512181146550280

    How did you end up fixing the issue

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.