Southclaws / storyden

With a fresh new take on traditional bulletin board forum software, Storyden is a modern, secure and extensible platform for building communities.
https://www.storyden.org/
Mozilla Public License 2.0
93 stars 11 forks source link

upgrade to Next.js 15 rc #228

Closed Southclaws closed 1 month ago

Southclaws commented 1 month ago

Trying https://nextjs.org/blog/next-15-rc2 v15 rc on latest Storyden frontend codebase

vercel[bot] commented 1 month ago

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

Name Status Preview Comments Updated (UTC)
storyden ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 10:20pm
1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **storyden-homepage** | ⬜️ Ignored ([Inspect](https://vercel.com/southclaws-projects/storyden-homepage/2hwihVYW9stmAiaepj5Rjc8rgUju)) | [Visit Preview](https://storyden-homepage-git-nextjs-15-rc-southclaws-projects.vercel.app) | | Oct 22, 2024 10:20pm |
coderabbitai[bot] commented 1 month ago
📝 Walkthrough
📝 Walkthrough ## Walkthrough The pull request introduces significant modifications to several functions and components to handle asynchronous operations. The `fetcher` and `getCookieHeader` functions are updated to use asynchronous calls for cookie retrieval. Multiple `Page` components across different files are altered to manage `params` and `searchParams` as promises, requiring the use of `await`. Additionally, functions related to server sessions and navigation are updated to access cookies asynchronously. The changes reflect a broader shift towards asynchronous programming within the application. ## Changes | File Path | Change Summary | |---------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------| | web/src/api/server.ts | Updated `fetcher` to await `getCookieHeader()`, which now returns a `Promise`. | | web/src/app/(bare)/auth/[provider]/callback/page.tsx | Changed `params` to `Promise<{ provider: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/@contextpane/d/[category]/page.tsx | Changed `params` to `Promise<{ category: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/@contextpane/t/[slug]/page.tsx | Changed `params` to `Promise<{ slug: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/d/[category]/page.tsx | Changed `params` to `Promise<{ category: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/l/[...slug]/page.tsx | Changed `params` to `Promise`; updated `Page` function to be async. | | web/src/app/(dashboard)/links/[slug]/page.tsx | Changed `params` to `Promise<{ slug: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/links/page.tsx | Changed `searchParams` to `Promise<{ q: string; page: number; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/m/[handle]/page.tsx | Changed `params` to `Promise<{ handle: string }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/m/page.tsx | Changed `searchParams` to `Promise<{ q: string; page: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/new/page.tsx | Changed `searchParams` to `Promise>`; updated `Page` function to be async. | | web/src/app/(dashboard)/search/page.tsx | Changed `searchParams` to `Promise`; updated `Page` function to be async. | | web/src/app/(dashboard)/t/[slug]/page.tsx | Changed `params` to `Promise<{ slug: string; }>`; updated `Page` function to be async. | | web/src/app/(dashboard)/t/page.tsx | Changed `searchParams` to `Promise`; updated `Page` function to be async. | | web/src/auth/server-session.ts | Updated `getServerSession` to await `cookies()`. | | web/src/components/site/NavigationPane/server.ts | Updated `getServerSidebarState` to await `cookies()`. | | web/src/components/site/Navigation/Anchors/Anchor.tsx | Modified `icon` prop handling in `Anchor` component to cast to `any`. | | web/src/components/ui/Slot.tsx | Updated prop handling in `Slot` component to cast `children.props` to an object type before spreading. | ## Possibly related PRs - **#206**: The changes in this PR involve reworking the category handling, including asynchronous data fetching and error handling, which aligns with the main PR's modifications to asynchronous behavior in functions like `getCookieHeader` and `fetcher`. - **#232**: This PR addresses various issues and enhancements in the thread view and drafts, which could relate to the main PR's focus on asynchronous function modifications and error handling, as both involve improving user experience and data management. > 🐇 In the meadow, we hop and play, > With promises bright, we greet the day. > As cookies now wait, in a queue so neat, > Our code dances lightly, a rhythmic beat. > Async we go, with joy we sing, > In the world of code, let the changes spring! 🌼

📜 Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
📥 Commits Files that changed from the base of the PR and between dc640a3737afe2795dec57405247cd1214e855eb and ab587128bbe2541d92a67346798740953ed01f50.
⛔ Files ignored due to path filters (2) * `web/package.json` is excluded by `!**/*.json` * `web/yarn.lock` is excluded by `!**/yarn.lock`, `!**/*.lock`, `!**/*.lock`
📒 Files selected for processing (20) * web/next.config.js (0 hunks) * web/src/api/server.ts (2 hunks) * web/src/app/(bare)/auth/[provider]/callback/page.tsx (2 hunks) * web/src/app/(dashboard)/@contextpane/d/[category]/page.tsx (1 hunks) * web/src/app/(dashboard)/@contextpane/t/[slug]/page.tsx (1 hunks) * web/src/app/(dashboard)/d/[category]/page.tsx (1 hunks) * web/src/app/(dashboard)/l/[...slug]/page.tsx (1 hunks) * web/src/app/(dashboard)/links/[slug]/page.tsx (1 hunks) * web/src/app/(dashboard)/links/page.tsx (1 hunks) * web/src/app/(dashboard)/m/[handle]/page.tsx (1 hunks) * web/src/app/(dashboard)/m/page.tsx (2 hunks) * web/src/app/(dashboard)/new/page.tsx (2 hunks) * web/src/app/(dashboard)/search/page.tsx (2 hunks) * web/src/app/(dashboard)/t/[slug]/opengraph-image.tsx (1 hunks) * web/src/app/(dashboard)/t/[slug]/page.tsx (2 hunks) * web/src/app/(dashboard)/t/page.tsx (2 hunks) * web/src/auth/server-session.ts (1 hunks) * web/src/components/site/Navigation/Anchors/Anchor.tsx (1 hunks) * web/src/components/site/Navigation/NavigationPane/server.ts (1 hunks) * web/src/components/ui/Slot.tsx (1 hunks)
💤 Files with no reviewable changes (1) * web/next.config.js
🚧 Files skipped from review as they are similar to previous changes (17) * web/src/api/server.ts * web/src/app/(bare)/auth/[provider]/callback/page.tsx * web/src/app/(dashboard)/@contextpane/d/[category]/page.tsx * web/src/app/(dashboard)/@contextpane/t/[slug]/page.tsx * web/src/app/(dashboard)/d/[category]/page.tsx * web/src/app/(dashboard)/l/[...slug]/page.tsx * web/src/app/(dashboard)/links/[slug]/page.tsx * web/src/app/(dashboard)/links/page.tsx * web/src/app/(dashboard)/m/[handle]/page.tsx * web/src/app/(dashboard)/m/page.tsx * web/src/app/(dashboard)/search/page.tsx * web/src/app/(dashboard)/t/[slug]/opengraph-image.tsx * web/src/app/(dashboard)/t/page.tsx * web/src/auth/server-session.ts * web/src/components/site/Navigation/Anchors/Anchor.tsx * web/src/components/site/Navigation/NavigationPane/server.ts * web/src/components/ui/Slot.tsx
🧰 Additional context used
🔇 Additional comments (3)
web/src/app/(dashboard)/t/[slug]/page.tsx (3)
`8-10`: **LGTM: Props type correctly updated for Next.js 15** The change to make `params` a Promise type aligns with Next.js 15's new async routing paradigm. --- `14-14`: **LGTM: Proper async handling of route parameters** The await on `props.params` is now correct and necessary with Next.js 15's async routing system. This is a breaking change from previous versions where params were synchronous. --- `25-26`: **LGTM: Metadata generation updated for async params** The changes to `generateMetadata` correctly handle the new async params pattern in Next.js 15. Let's verify that all metadata generators in the codebase have been updated:
✅ Verification successful Let me try a different pattern to search for metadata generators in the codebase. --- **All metadata generators are properly async, but only one uses params** Based on the search results, I found that: - All `generateMetadata` functions in the codebase are correctly declared as async - Only the file under review `web/src/app/(dashboard)/t/[slug]/page.tsx` uses `params` parameter - Other metadata generators either take no parameters or return typed Promise This makes sense because: 1. Only dynamic route pages (with [slug]) need params 2. Other pages are static routes where metadata doesn't depend on URL parameters
🏁 Scripts executed The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Check for any remaining synchronous metadata generators that might need updates # Look for generateMetadata functions that don't properly await params ast-grep --pattern 'export async function generateMetadata({ params }: $_) { $$$ }' ``` Length of output: 87 --- Script: ```shell #!/bin/bash # Search for all generateMetadata function declarations ast-grep --pattern 'export $_ function generateMetadata($_) { $$$ }' # Also search with ripgrep to catch any variations rg "export.*generateMetadata" -A 3 ``` Length of output: 1456
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.