-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
how to get current pathname in server component? #84
Comments
That's my next action item:
Stay tuned! |
My workaround: const AppCreator = (pathname: string) => (props): ReactElement => {
return (
<div className="flex flex-col-reverse sm:flex-row">
<nav className="w-full sm:w-64">
<Sidebar />
</nav>
<main className="flex-1 p-6 w-full sm:w-[calc(100%-16rem)]">
{/*<Editor />*/}
</main>
</div>
);
}; export default defineRouter(
async id => {
switch (id) {
case 'index': {
const { default: AppCreator } = await import('./src/app.js');
return AppCreator(id)
}
default:
return null;
}
},
async () => {
return ['index'];
}
); |
My workflow is to implement a document generator using waku (as you can see the code in https://github.com/toeverything/AFFiNE/tree/master/apps/docs). So the logics are
|
I think that works too. |
I thought something like #86 might help, but it actually doesn't because of caching. |
isn't it possible to just pass a prop to the element in the router definition and thus avoid recreating the component? I did something like that here a while ago |
Yeah, that's possible too. It's almost like making Do you know how bad is |
* wip: examples 01 dev * hack with _ssr, not ideal though * examples 02 * simplify waku/client usage * example 03 * example 04 * improve example 04 * examples 05 * example 06 * fix example 06 * support children * wip: waku/router, which is tough one * rename from Server to Slot * wip: fix router * refactor consistent names * wip: fix router * add react hooks eslint plugin * improve prefetched * fix example 08 * fix example 09 * fix test * wip: ssr config * fix ex 06 * fix waku/router * wip: website * fix interleaveHtmlSnippets * remove unstable_rootDir * fix router build * fix explicit index path (suboptimal?) * this should be a proper fix * website: use path prop #84 * fix action and improve example/06 * re-design router input string and allow client cache control * update website * make initialInput prop optional * use "" for initial input for simplicity * fix and a workaround for empty input string, seems suboptimal..
The text was updated successfully, but these errors were encountered: