Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(create-pages): page part component #1313

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

tylersayshi
Copy link
Member

@tylersayshi tylersayshi commented Mar 19, 2025

page part components open up support for multiple components per each page. These components are siblings in place of where a page component would be typically.

this is useful for marking parts of a page static and other parts dynamic.

Copy link

vercel bot commented Mar 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Mar 24, 2025 2:48am

Copy link

codesandbox-ci bot commented Mar 24, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@tylersayshi tylersayshi marked this pull request as ready for review March 24, 2025 02:14
@tylersayshi
Copy link
Member Author

ah page parts pages need to be added to the typegen /draft

@tylersayshi tylersayshi marked this pull request as draft March 24, 2025 02:18
@tylersayshi tylersayshi marked this pull request as ready for review March 24, 2025 02:48
@tylersayshi tylersayshi changed the title feat: page part component feat(create-pages): page part component Mar 24, 2025
tylersayshi added a commit that referenced this pull request Mar 24, 2025
@tylersayshi tylersayshi self-assigned this Mar 24, 2025
@@ -237,6 +252,11 @@ export const createPages = <
createLayout: CreateLayout;
createRoot: CreateRoot;
createApi: CreateApi;
/**
* Page Part pages are assumed to be dynamic in order to allow dynamic components.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a limitation.
Can't we make all page parts static and make the entire page static?

Copy link
Member Author

@tylersayshi tylersayshi Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you can, but why would you?

If your goal is to make a static page, shouldn't you just use createPage?

createPagePart only seems useful when you're mixing dynamic and static which then requires the page to be dynamic, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you just use createPage?

Technically, not always.

getConfig itself is dynamically configurable at build time.

export const getConfig = async () => {
  return {
    render: Date.now() < SOME_POINT ? 'static' : 'dynamic',
  };
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean. I can add logic for static page when all parts are static in that case. Thanks for the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants