Skip to content

Unclear documentation around precompute #73

@mastoj

Description

@mastoj

I started experimenting with flags for real in preparation migrating our production site to it instead of using our own solution. I did find some issues around precompute.

I'm testing with canary since I also want to run with dynamicIO, so it might be that is what causing the issue.

The code for the sample is here: https://github.com/mastoj/flags-experiment

I have a very simple middleware where I calculate the code: https://github.com/mastoj/flags-experiment/blob/3f3569987306ce6c2f7ddf31441a35820ae2bf10/middleware.ts#L15-L20

and a very simple page: https://github.com/mastoj/flags-experiment/blob/main/app/%5Bcode%5D/%5Bslug%5D/page.tsx

The issue I get when building is:

Collecting page data ..[Error: A required root parameter (code) was not provided in generateStaticParams for /[code], please provide at least one value.]

Build error occurred
[Error: Failed to collect page data for /[code]] { type: 'Error' }

I actually thought that I could use

export async function generateStaticParams() {
  return [];
}

but for some reason { code: } is required... but that would also mean creating something static. I do want it SSR and cached, but not during build time.

Is I doing something wrong with flags or have I misunderstood something with dynamicIO?

To reproduce you should be able to pull down the code and the:

pnpm install
pnpm run build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions