Skip to content

Dynamic route content loading as a function #3380

Open
@dCastanho

Description

@dCastanho

Is your feature request related to a problem? Please describe.

I'm currently working on a solution to create a vitepress site from a CMS, which contains quite a few pages. We are using dynamic routes to fetch the existing data and are essentially using one template and one path loader, as we cannot determine previously how the site is structured and generate the appropriate path loader for each part of the site. However, because we need to load all the content into memory to return the list in the paths loader, we are reaching very high memory usage which we would like to mitigate to avoid future problems as the content in the CMS will grow.

Describe the solution you'd like

The solution I'm proposing is to allow content in the return of paths() to be provided as a function (possibly an async one) , so that the content can be loaded as each page is generated and not previously, thus avoiding the memory overload.

Describe alternatives you've considered

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions