-
-
Notifications
You must be signed in to change notification settings - Fork 124
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: new create pages to use new defineRouter #963
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
I'm working on replacing the structures here: https://github.com/dai-shi/waku/blob/main/packages/waku/src/router/create-pages.ts#L190-L205 with a lookup that will be from path to components for that path like is done here: https://github.com/dai-shi/waku/blob/main/examples/22_define-router/src/entries.tsx#L66-L87 Initially I thought this would be good to do after, but as I am seeing the new defineEntries style it seems clear that changing these structures first will be the best approach. |
62b38ce
to
30fafaf
Compare
30fafaf
to
f610216
Compare
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. |
f610216
to
6764c3d
Compare
1123ef0
to
921cc1e
Compare
921cc1e
to
0c09804
Compare
0c09804
to
a98b73e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay.
I need to work on I'll follow up here after fixing |
@dai-shi if this code had a layout at would it change to the following? {
pattern: '/bar',
path: [{ type: 'literal', name: 'bar' }],
components: {
'route:/bar': { isStatic: true },
root: { isStatic: true },
'layout:/': { isStatic: true },
'layout:/bar': { isStatic: true },
'page:/bar': { isStatic: true },
},
}, |
This comment was marked as outdated.
This comment was marked as outdated.
Should the other examples be moved to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I find it very difficult to prove correctness, mainly due to the lack of tests (my bad) for static/dynamic component behavior.
Let me play with it and see if I can find anything.
If we made this change, diff --git a/examples/21_create-pages/src/components/NestedBazPage.tsx b/examples/21_create-pages/src/components/NestedBazPage.tsx
index ed7488f7..96f6ddd1 100644
--- a/examples/21_create-pages/src/components/NestedBazPage.tsx
+++ b/examples/21_create-pages/src/components/NestedBazPage.tsx
@@ -2,6 +2,7 @@ const Baz = () => (
<div>
<h2>Nested</h2>
<h3>Baz</h3>
+ <p>{new Date().toISOString()}</p>
</div>
);
diff --git a/examples/21_create-pages/src/entries.tsx b/examples/21_create-pages/src/entries.tsx
index e214e5a4..9dcdbe81 100644
--- a/examples/21_create-pages/src/entries.tsx
+++ b/examples/21_create-pages/src/entries.tsx
@@ -48,7 +48,7 @@ const pages = new_createPages(
}),
createPage({
- render: 'static',
+ render: 'dynamic',
path: '/nested/baz',
component: NestedBazPage,
}), we should see the latest date, but it's not. I haven't looked into it wether the issue is in |
Changing the other I can add a test for the date bug you mentioned as well though. |
hmmm did you run It seems like it's updating for me Screen.Recording.2024-11-05.at.10.52.39.PM.movpretty sure this is the same diff but pasting to be 1000% sure haha ! ~/gitspace/waku new-create-pages git diff 3m
diff --git a/examples/21_create-pages/src/components/NestedBazPage.tsx b/examples/21_create-pages/src/components/NestedBazPage.tsx
index ed7488f..96f6ddd 100644
--- a/examples/21_create-pages/src/components/NestedBazPage.tsx
+++ b/examples/21_create-pages/src/components/NestedBazPage.tsx
@@ -2,6 +2,7 @@ const Baz = () => (
<div>
<h2>Nested</h2>
<h3>Baz</h3>
+ <p>{new Date().toISOString()}</p>
</div>
);
diff --git a/examples/21_create-pages/src/entries.tsx b/examples/21_create-pages/src/entries.tsx
index e214e5a..9dcdbe8 100644
--- a/examples/21_create-pages/src/entries.tsx
+++ b/examples/21_create-pages/src/entries.tsx
@@ -48,7 +48,7 @@ const pages = new_createPages(
}),
createPage({
- render: 'static',
+ render: 'dynamic',
path: '/nested/baz',
component: NestedBazPage,
}), |
I'm sorry, it was about when we do client navigation. Like, clicking "Home" and then clicking "Nested / Baz". |
This is how it works with the current Screen.Recording.2024-11-06.at.20.42.12.mov |
unsure if this fix is the best way to fix the issue, but the issue with nested/baz not re-rendering on client side navigation was because |
5f927b6
to
9431ec2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
element.isStatic should only be about the element.
This adds a new version of
createPages
to usenew_defineRouter
asnew_createPages