Kantros
Kantros
WWasp-lang
Created by Kantros on 5/5/2024 in #đŸ™‹questions
Lazy Loading React Components
When making a large application it is best practice to lazy load components as needed. It seems there is no way to lazy load a route in wasp?
route AnotherRoute { path: "/test", to: AnotherRoute }
page AnotherRoute {
component: import { AnotherRoute} from "@src/client/AnotherRoute",
}
route AnotherRoute { path: "/test", to: AnotherRoute }
page AnotherRoute {
component: import { AnotherRoute} from "@src/client/AnotherRoute",
}
I have this route definition. It is in the JS bundle even though I have never navigated to it. This would be an issue as the application grows in size, when a user navigates to the landing page, they will need to download the ENTIRE app. Does WASP have a way to lazy load components using the build in routing?
15 replies
WWasp-lang
Created by Kantros on 4/28/2024 in #đŸ™‹questions
Passing Context for Dependency Injection
Is there a standard pattern for passing the context object for database interaction to functions? When using Prisma, I can always pass the Prisma client to another function and have full type suggestions. when using wasp, routes are given a "context" object with an array of accessible entities that are defined in the wasp definition. is there a way to pass around the context object with typing to other functions in the same way that is possible with standard Prisma? wasp: version: 0.13.2. WSL2, Ubuntu 22.
8 replies