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

chore: Update SolidStart example #984

Closed
wants to merge 1 commit into from
Closed

Conversation

juraj98
Copy link
Contributor

@juraj98 juraj98 commented Sep 24, 2024

When working on example for tanstack/start I ran into CI lint issue because of different versions of vinxi for SolidStart and tanstack/start. I decided to update the solidstart example first. Full list of changes:

  • Updated dependencies to the newest version with appropriate code changes.
  • Removed tailwind and imported @uploadthing/solid/styles.css instead.
  • Changed few console.logs and alerts in index route to be consistent.

I'll update solid start getting started docs next and link the PR here.

@juliusmarminge, this might conflict with #980.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced enhanced upload event handling with specific logging and user feedback during file uploads.
    • Added hot reloading support for development environments.
  • Bug Fixes

    • Improved clarity in API event handling by separating GET and POST exports.
  • Chores

    • Updated various package dependencies for improved performance and security.
    • Removed unused PostCSS and Tailwind CSS configurations.
    • Updated TypeScript configuration for better module resolution and type definitions.

Copy link

changeset-bot bot commented Sep 24, 2024

⚠️ No Changeset found

Latest commit: 82611ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Sep 24, 2024

Walkthrough

This pull request introduces several updates across multiple files in the project. Key changes include updates to the package.json dependencies, the removal of PostCSS and Tailwind CSS configurations, and enhancements to the upload handling logic in the index.tsx file. Additionally, the export structure for upload handlers has been modified for clarity. The TypeScript configuration has also been adjusted to reflect changes in module resolution and type definitions.

Changes

File Path Change Summary
examples/minimal-solidstart/package.json Updated dependencies and added a new script for versioning.
examples/minimal-solidstart/postcss.config.cjs Removed PostCSS configuration file.
examples/minimal-solidstart/src/app.tsx Modified imports and removed title management functionality.
examples/minimal-solidstart/src/entry-client.tsx Added a comment for hot reloading; existing functionality preserved.
examples/minimal-solidstart/src/entry-server.tsx Added a comment for hot reloading; removed favicon link from the head section.
examples/minimal-solidstart/src/global.css Removed Tailwind CSS directives from the global stylesheet.
examples/minimal-solidstart/src/routes/api/uploadthing.ts Changed export structure for upload handlers to define separate GET and POST functions.
examples/minimal-solidstart/src/routes/index.tsx Enhanced upload event handling with new logging and alert features.
examples/minimal-solidstart/src/server/uploadthing.ts Renamed type alias for the file router from OurFileRouter to UploadRouter.
examples/minimal-solidstart/src/utils/uploadthing.ts Updated type parameters in upload-related functions to use UploadRouter.
examples/minimal-solidstart/tailwind.config.ts Removed Tailwind CSS configuration file.
examples/minimal-solidstart/tsconfig.json Modified TypeScript compiler options, changing module resolution and type definitions.

Possibly related PRs

Suggested labels

📚 documentation

Suggested reviewers

  • juliusmarminge

Poem

In the garden of code, changes bloom bright,
With uploads enhanced, and scripts taking flight.
PostCSS and Tailwind, now just memories past,
As we hop to new features, our joy unsurpassed!
So here's to the updates, both clever and spry,
A rabbit's delight, as we reach for the sky! 🐇✨


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 39be202 and 82611ef.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (12)
  • examples/minimal-solidstart/package.json (1 hunks)
  • examples/minimal-solidstart/postcss.config.cjs (0 hunks)
  • examples/minimal-solidstart/src/app.tsx (1 hunks)
  • examples/minimal-solidstart/src/entry-client.tsx (1 hunks)
  • examples/minimal-solidstart/src/entry-server.tsx (1 hunks)
  • examples/minimal-solidstart/src/global.css (0 hunks)
  • examples/minimal-solidstart/src/routes/api/uploadthing.ts (1 hunks)
  • examples/minimal-solidstart/src/routes/index.tsx (2 hunks)
  • examples/minimal-solidstart/src/server/uploadthing.ts (1 hunks)
  • examples/minimal-solidstart/src/utils/uploadthing.ts (2 hunks)
  • examples/minimal-solidstart/tailwind.config.ts (0 hunks)
  • examples/minimal-solidstart/tsconfig.json (1 hunks)
Files not reviewed due to no reviewable changes (3)
  • examples/minimal-solidstart/postcss.config.cjs
  • examples/minimal-solidstart/src/global.css
  • examples/minimal-solidstart/tailwind.config.ts
Files skipped from review as they are similar to previous changes (9)
  • examples/minimal-solidstart/package.json
  • examples/minimal-solidstart/src/app.tsx
  • examples/minimal-solidstart/src/entry-client.tsx
  • examples/minimal-solidstart/src/entry-server.tsx
  • examples/minimal-solidstart/src/routes/api/uploadthing.ts
  • examples/minimal-solidstart/src/routes/index.tsx
  • examples/minimal-solidstart/src/server/uploadthing.ts
  • examples/minimal-solidstart/src/utils/uploadthing.ts
  • examples/minimal-solidstart/tsconfig.json

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
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Sep 24, 2024

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

Name Status Preview Comments Updated (UTC)
docs-uploadthing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 2:57pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
legacy-docs-uploadthing ⬜️ Ignored (Inspect) Visit Preview Sep 24, 2024 2:57pm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (5)
examples/minimal-solidstart/src/routes/api/uploadthing.ts (1)

11-12: Approve: Improved export implementation with a minor suggestion

The new GET and POST exports are well-implemented, providing explicit typing and allowing for potential method-specific logic in the future. This change enhances the clarity and maintainability of the code.

For consistency with the rest of the file, consider using regular function declarations instead of arrow functions. This is a minor stylistic suggestion:

-export const GET = (event: APIEvent) => handler(event.request);
-export const POST = (event: APIEvent) => handler(event.request);
+export function GET(event: APIEvent) { return handler(event.request); }
+export function POST(event: APIEvent) { return handler(event.request); }

This change would align with the style used for the createRouteHandler function above.

examples/minimal-solidstart/src/app.tsx (1)

Application title is not being set: The removal of the Title component from app.tsx means that the document title is no longer being set within the application routes. Please ensure that the title is set appropriately elsewhere to maintain functionality and SEO benefits.

Analysis chain

Line range hint 1-23: LGTM! The changes look good and align with the PR objectives.

The updates to the imports and component structure are consistent with the described changes in the PR. The removal of the Title component and its import simplifies the App component. The addition of the CSS import for @uploadthing/solid is a good practice for including component-specific styles.

To ensure that the application title is still set correctly, please run the following script:

This will help verify if the title is being set in any of the route files, which is a common practice in SolidStart applications.


[/run_scripts]

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the document title is set in any of the route files

# Search for title setting in route files
rg --type tsx 'Title|document\.title' src/routes

Length of output: 78


Script:

#!/bin/bash
# Description: Check if the document title is set in any of the .tsx route files

# Find all .tsx files in src/routes and search for Title or document.title
fd --extension tsx src/routes | xargs rg 'Title|document\.title'

Length of output: 3048

examples/minimal-solidstart/src/routes/index.tsx (3)

28-36: LGTM: Enhanced event handlers for UploadButton

The additions and modifications to the UploadButton event handlers are good improvements:

  1. The new onUploadBegin handler provides consistent logging with the createUploadThing implementation.
  2. The onUploadAborted handler adds valuable user feedback for aborted uploads.
  3. The onClientUploadComplete handler now logs the entire response object, enhancing debugging capabilities.

These changes align well with the PR objectives of modifying console.log statements and alert calls for consistency.

Consider using template literals for the console.log statements to maintain consistency across the codebase. For example:

-console.log("onUploadBegin", fileName);
+console.log(`onUploadBegin: ${fileName}`);

44-54: LGTM: Enhanced event handlers for UploadDropzone

The additions and modifications to the UploadDropzone event handlers mirror those made to the UploadButton, which is excellent for maintaining consistency:

  1. The new onUploadBegin handler provides consistent logging.
  2. The onUploadAborted handler adds valuable user feedback for aborted uploads.
  3. The onClientUploadComplete handler now logs the entire response object, enhancing debugging capabilities.

These changes align well with the PR objectives and maintain consistency across different upload components.

As suggested for the UploadButton, consider using template literals for the console.log statements:

-console.log("onUploadBegin", fileName);
+console.log(`onUploadBegin: ${fileName}`);

Line range hint 1-70: Summary: Improved upload handling and consistency

The changes made to this file significantly enhance the upload handling capabilities of the Home component:

  1. Consistent onUploadBegin handlers have been added across createUploadThing, UploadButton, and UploadDropzone, improving debugging capabilities.
  2. New onUploadAborted handlers in UploadButton and UploadDropzone provide better user feedback for aborted uploads.
  3. The onClientUploadComplete handlers now log the entire response object, offering more comprehensive debugging information.

These modifications align well with the PR objectives of updating console.log statements and alert calls for consistency. They also improve the overall user experience and debugging process for file uploads.

Consider extracting the common event handling logic into a separate utility function or hook to reduce code duplication and improve maintainability. This would make it easier to update all upload-related components consistently in the future.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 073c4ec and 39be202.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (12)
  • examples/minimal-solidstart/package.json (1 hunks)
  • examples/minimal-solidstart/postcss.config.cjs (0 hunks)
  • examples/minimal-solidstart/src/app.tsx (1 hunks)
  • examples/minimal-solidstart/src/entry-client.tsx (1 hunks)
  • examples/minimal-solidstart/src/entry-server.tsx (1 hunks)
  • examples/minimal-solidstart/src/global.css (0 hunks)
  • examples/minimal-solidstart/src/routes/api/uploadthing.ts (1 hunks)
  • examples/minimal-solidstart/src/routes/index.tsx (2 hunks)
  • examples/minimal-solidstart/src/server/uploadthing.ts (1 hunks)
  • examples/minimal-solidstart/src/utils/uploadthing.ts (2 hunks)
  • examples/minimal-solidstart/tailwind.config.ts (0 hunks)
  • examples/minimal-solidstart/tsconfig.json (1 hunks)
Files not reviewed due to no reviewable changes (3)
  • examples/minimal-solidstart/postcss.config.cjs
  • examples/minimal-solidstart/src/global.css
  • examples/minimal-solidstart/tailwind.config.ts
Files skipped from review due to trivial changes (1)
  • examples/minimal-solidstart/src/server/uploadthing.ts
Additional comments not posted (13)
examples/minimal-solidstart/src/entry-client.tsx (1)

1-1: LGTM! Improved development experience with hot reloading.

The addition of the // @refresh reload comment directive is a positive change. This directive enables hot reloading in development environments, allowing for automatic updates to the UI without a full page refresh. This improvement aligns well with the PR's objective of updating the SolidStart example and enhances the developer experience.

examples/minimal-solidstart/src/routes/api/uploadthing.ts (2)

1-1: LGTM: Appropriate type import added

The import of APIEvent from "@solidjs/start/server" is correct and necessary for typing the event parameters in the new GET and POST functions. This change enhances type safety without affecting runtime performance.


1-12: Summary: Improved type safety and API structure

The changes in this file successfully update the SolidStart example by improving type safety and clarifying the API structure. The explicit GET and POST exports with proper typing enhance the maintainability of the code and align well with modern TypeScript and SolidStart practices. These modifications contribute positively to the overall objective of updating the SolidStart example and resolving CI lint issues.

examples/minimal-solidstart/tsconfig.json (1)

5-5: LGTM! TypeScript configuration updates look good.

The changes to moduleResolution and types are appropriate updates that align with modern web development practices and the project's dependencies. These modifications should help resolve the CI lint issues mentioned in the PR objectives.

To ensure these changes don't negatively impact other parts of the project, please run the following verification:

This script will help identify any potential TypeScript errors introduced by the configuration changes and highlight any vinxi imports that might need attention due to the updated type definitions.

Also applies to: 13-13

examples/minimal-solidstart/src/entry-server.tsx (2)

1-1: LGTM: Added refresh directive for improved development experience.

The addition of // @refresh reload is a good practice for enabling hot module replacement or live reloading in development environments. This will help developers see changes in real-time without manual page refreshes.


Line range hint 8-13: Verify the removal of the favicon link.

The favicon link (<link rel="icon" href="/favicon.ico" />) has been removed from the <head> section. While this doesn't affect functionality, it may impact the user experience as browsers typically use favicons to represent the site in tabs and bookmarks.

Could you please confirm if:

  1. The favicon is being set through another method (e.g., in a different component or using a meta tag)?
  2. This removal was intentional and aligns with the project's design decisions?

If the removal was unintended, consider re-adding the favicon link:

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="icon" href="/favicon.ico" />
  {assets}
</head>
examples/minimal-solidstart/src/utils/uploadthing.ts (3)

16-17: LGTM! Type parameters updated consistently.

The type parameters for UploadButton and UploadDropzone have been correctly updated to use the new UploadRouter type. This change maintains type safety and consistency with the import statement modification.


7-7: LGTM! Verify the import path.

The change from OurFileRouter to UploadRouter is consistent with the modifications in the exported entities. This suggests an improvement in naming conventions or project structure.

To ensure the import path is correct, run the following script:

#!/bin/bash
# Description: Verify the existence of the UploadRouter in the specified path

# Test: Check if the file exists and contains the UploadRouter export
rg --type typescript -e "export.*UploadRouter" "server/uploadthing.ts"

19-19: LGTM! Verify usage of createUploadThing in the codebase.

The type parameter for generateSolidHelpers has been correctly updated to use the new UploadRouter type, maintaining consistency with the other changes.

To ensure that all usages of createUploadThing are compatible with this change, run the following script:

This will help identify any potential areas that might need updates due to the type change.

Verification successful

Action Required: Update the shell script to correctly target TypeScript files.

The previous script encountered an error because rg does not recognize the typescript type. Please update the script to search for .ts files instead.


Verified: createUploadThing is used only within internal implementation files. No further action required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check usages of createUploadThing in the codebase

# Test: Find all occurrences of createUploadThing
rg --type typescript -e "createUploadThing" -g '!**/uploadthing.ts'

Length of output: 105


Script:

#!/bin/bash
# Description: Check usages of createUploadThing in the codebase

# Test: Find all occurrences of createUploadThing in TypeScript files
rg -g '*.ts' -e "createUploadThing" --glob '!uploadthing.ts'

Length of output: 645

examples/minimal-solidstart/package.json (2)

8-10: LGTM: Script updates align with dependency changes

The updates to the scripts section are consistent with the dependency updates mentioned in the PR objectives. The addition of the "version" script suggests improved version management capabilities with vinxi.


13-19: Dependency updates look good, but verify @uploadthing versions

The updates to @solidjs packages and vinxi align with the PR objectives and should resolve the CI lint issue. However, please verify if the versions for @uploadthing/solid (7.0.2) and uploadthing (7.0.2) are the latest available, as they remain unchanged.

To verify the latest versions of @uploadthing packages, run:

examples/minimal-solidstart/src/routes/index.tsx (2)

12-14: LGTM: Added onUploadBegin handler

The new onUploadBegin handler is a good addition. It provides useful debugging information by logging the filename when an upload begins, which aligns with the PR objectives of modifying console.log statements for consistency.


15-18: LGTM: Enhanced onClientUploadComplete handler

The modification to the onClientUploadComplete handler is an improvement. By logging the entire response object, it provides more comprehensive debugging information. This change aligns with the PR objectives of modifying console.log statements for consistency while maintaining the existing user feedback through the alert.

@juraj98
Copy link
Contributor Author

juraj98 commented Sep 24, 2024

Broke pnpm-lock.yaml. I'll close this and reopen again 🤦

@juraj98 juraj98 closed this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant