Code Monkey home page Code Monkey logo

Comments (3)

walterdiazesa avatar walterdiazesa commented on July 18, 2024 1

@nurul3101 Your understanding is correct. Not only that, but I also tested your hypothesis, and it's right.

I commented out UserPreview in users/[slug].tsx and no error was thrown. I started to debug and noticed that nothing inside that JSX component was the problem.

The problem was that I had import prisma from "@/lib/prisma"; and

export const getPublicUser = async (where: Prisma.userWhereUniqueInput) => {
  const userUnique = prisma.user.findUniqueOrThrow({
  ...

in the same file where the UserPreview component was defined (components/User/Preview/index.tsx)

So I used components/User/Preview/index.tsx only for the JSX and moved getPublicUser to another file, and the error is gone, fixed!

I'm just wondering, why isn't the behavior the same between using Accelerate and not using it? Even though the problem is fixed, should I expect any changes in how Accelerate affects the """bundle""" (I'm unaware of the correct term as I'm ignorant of what's actually happening under the hood) to be able to use my original code, or is this code refactoring expected when using Accelerate?

from prisma.

nurul3101 avatar nurul3101 commented on July 18, 2024

Hey @walterdiazesa 👋

Thank you for raising this.

If I understand this correctly, Prisma Accelerate works as expected for your one route (pages/works/[slug]/index.tsx) but it doesn't for the other route (pages/users/[slug].tsx) correct?

I see that in your users/[slug].tsx you are importing a component called UserPreview which I assume returns some JSX?
Could you temporarily comment usage of UserPreview in the users/[slug].tsx file and check if you still get the error? My assumption is that the error is caused in components/User/Preview/index.tsx file.

from prisma.

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.