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

♻️ Move trpc client #1421

Merged
merged 1 commit into from
Oct 31, 2024
Merged

♻️ Move trpc client #1421

merged 1 commit into from
Oct 31, 2024

Conversation

lukevella
Copy link
Owner

@lukevella lukevella commented Oct 31, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced registration process with improved error handling for user feedback.
    • Updated PollStatusMenu to allow dynamic handling of poll status changes.
  • Bug Fixes

    • Resolved issues with TRPC client integration across various components, ensuring consistent functionality.
  • Documentation

    • Updated import paths for the TRPC client to reflect new module organization.
  • Chores

    • Refactored import statements across multiple files to streamline TRPC client access.

These updates enhance the user experience by improving functionality and ensuring a more reliable application.

Copy link

vercel bot commented Oct 31, 2024

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

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 10:19pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
landing ⬜️ Skipped (Inspect) Oct 31, 2024 10:19pm

@vercel vercel bot temporarily deployed to Preview – landing October 31, 2024 22:12 Inactive
Copy link
Contributor

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request includes a comprehensive update of import paths for the trpc utility across multiple components and files within the application. The import statements have been changed from @/utils/trpc/client to @/trpc/client, reflecting a restructuring of the module organization. While the core logic and functionality of the components remain intact, some files also introduce minor enhancements or updates related to handling specific functionalities, such as user interactions and state management.

Changes

File Change Summary
apps/web/src/app/[locale]/(admin)/dashboard.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(admin)/events/past-events.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(admin)/events/upcoming-events.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client; added onStatusChange prop.
apps/web/src/app/[locale]/(admin)/settings/billing/billing-page.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(admin)/settings/profile/delete-account-dialog.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client; added deleteAccount mutation.
apps/web/src/app/[locale]/(admin)/settings/profile/profile-picture.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(admin)/settings/profile/profile-settings.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/(auth)/register/register-page.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client; refined registration logic.
apps/web/src/app/[locale]/auth/login/login-page.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/[locale]/invite/[urlId]/layout.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/app/providers.tsx Import path updated for trpcConfig from @/utils/trpc/config to @/trpc/client/config.
apps/web/src/components/create-poll.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/discussion/discussion.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/layouts/poll-layout.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/participant-dropdown.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client; updated ChangeNameModal.
apps/web/src/components/participants-provider.tsx Import paths updated for trpc and Vote from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/poll-context.tsx Import path updated for GetPollApiResponse and Vote from @/utils/trpc/types to @/trpc/client/types.
apps/web/src/components/poll/desktop-poll/participant-row.tsx Import path updated for Vote from @/utils/trpc/types to @/trpc/client/types.
apps/web/src/components/poll/manage-poll/delete-poll-dialog.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/poll/mutations.ts Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/poll/notifications-toggle.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/poll/use-touch-beacon.ts Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/components/user-provider.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/contexts/plan.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/contexts/poll.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/pages/_app.tsx Import path updated for trpc from @/utils/trpc/client to @/trpc/client.
apps/web/src/trpc/client.ts Import path updated for trpcConfig from @/utils/trpc/config to @/trpc/client/config.

Possibly related PRs

🐰 "In the code we hop and play,
Imports change in a bright new way.
From utils to trpc's charm,
Our components now feel warm.
With paths aligned, we leap with glee,
A cleaner code for you and me!" 🐇✨


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
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 (11)
apps/web/src/app/providers.tsx (1)

11-11: LGTM! Good architectural improvement.

Moving TRPC client from utils to a dedicated trpc directory is a better architectural choice as it reflects TRPC's role as a core part of the application rather than just a utility.

apps/web/src/app/[locale]/(admin)/settings/profile/delete-account-dialog.tsx (3)

Line range hint 37-45: Consider adding error handling to the mutation.

While the success path is well-handled, there's no error handling for failed account deletions. This could leave users uncertain about the operation's status if it fails.

Consider adding an onError handler:

 const deleteAccount = trpc.user.delete.useMutation({
   onSuccess() {
     posthog?.capture("delete account");
     trpcUtils.invalidate();
     signOut({
       callbackUrl: "/login",
     });
   },
+  onError(error) {
+    posthog?.capture("delete account error", { error: error.message });
+    // Handle error notification to user
+  },
 });

Line range hint 54-57: Add error handling to form submission.

The async form submission lacks error handling, which could lead to silent failures.

Implement proper error handling:

 onSubmit={form.handleSubmit(async () => {
-  await deleteAccount.mutateAsync();
+  try {
+    await deleteAccount.mutateAsync();
+  } catch (error) {
+    // Handle form submission error
+  }
 })}

Line range hint 89-98: Enhance security for email confirmation input.

While the email confirmation is good practice, consider additional security measures for this sensitive operation.

Add these security-focused attributes to the Input component:

 <Input
   autoComplete="off"
   data-1p-ignore
+  autoCapitalize="off"
+  autoCorrect="off"
+  spellCheck="false"
   error={!!form.formState.errors.email}
   placeholder={email}
   {...field}
 />
apps/web/src/components/poll/notifications-toggle.tsx (1)

Line range hint 41-41: Consider implementing a separate watchers query

The TODO comment suggests separating the watchers query. This could improve:

  • Query granularity and caching
  • Performance optimization
  • State management

Would you like me to help design and implement a separate query for watchers? This could involve:

  1. Creating a new trpc procedure specifically for watcher status
  2. Optimizing the query with proper caching strategies
  3. Updating the component to use the new query
apps/web/src/components/create-poll.tsx (1)

Based on the search results, I can now generate the final response. The results show that networkMode: "always" is only used in the create-poll mutation and is not a pattern followed by any other mutations in the codebase. All other mutations use the default network mode, which is more appropriate for their use cases.

The networkMode: "always" configuration appears to be unnecessary.

The search results show that:

  • Out of all TRPC mutations in the codebase, only the createPoll mutation uses this configuration
  • Other similar operations like updatePoll, deletePoll, and all participant-related mutations work fine with the default network mode
  • There's no specific requirement or architectural decision that justifies this special network mode for poll creation

The default network mode would be more appropriate as it:

  • Provides better handling of offline scenarios
  • Prevents unnecessary retries
  • Maintains consistency with the rest of the codebase
🔗 Analysis chain

Line range hint 65-69: Verify the necessity of networkMode: "always".

The mutation is configured with networkMode: "always", which means it will attempt to execute even when the network is unreliable. For a poll creation operation, this might lead to:

  • Unnecessary retries
  • Potential duplicate submissions
  • Hanging operations in poor network conditions

Consider if this is the intended behavior or if the default network mode would be more appropriate.

Let's check if this configuration is consistent across other mutation calls:


Let me also try a broader search to catch potential variations:

And let's specifically look for networkMode configurations:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other trpc mutation configurations to verify consistency
rg -A 2 "useMutation\({" --type tsx

Length of output: 129


Script:

#!/bin/bash
# Search for trpc mutation configurations with proper regex escaping
rg -A 2 "useMutation\(\{" --type tsx

Length of output: 66


Script:

#!/bin/bash
# Search for useMutation usage with more flexible pattern
rg "useMutation" --type tsx -B 1 -A 3

Length of output: 65


Script:

#!/bin/bash
# Search for networkMode configurations
rg "networkMode.*:" --type tsx -B 2 -A 1

Length of output: 70


Script:

#!/bin/bash
# Search for useMutation usage without file type restriction
rg "useMutation" -B 1 -A 3

Length of output: 12143


Script:

#!/bin/bash
# Search for networkMode configurations without file type restriction
rg "networkMode.*:" -B 2 -A 1

Length of output: 333


Script:

#!/bin/bash
# Find TypeScript/React files that might contain mutations
fd "\.(tsx|ts)$"

Length of output: 17368

apps/web/src/components/poll-context.tsx (1)

Line range hint 24-24: Consider addressing the TODO comment during this restructuring.

Since we're already restructuring the trpc client, this might be a good opportunity to move the participant-related functionality to the participants provider as noted in the TODO comment. This would improve code organization and separation of concerns.

Would you like me to help create a separate PR to move these participant-related functions to the participants provider?

apps/web/src/app/[locale]/(admin)/settings/billing/billing-page.tsx (2)

Line range hint 190-215: Remove duplicate support section.

This appears to be dead code as the same support section is implemented within the BillingPage component below.

Remove this standalone JSX element to avoid confusion and maintain code cleanliness.


Line range hint 20-26: Consider adding proper type definitions for Paddle.

Instead of using any, consider adding proper type definitions for the Paddle SDK to improve type safety.

Create a types file (e.g., paddle.d.ts) with proper type definitions:

interface PaddleCheckout {
  open(options: { override: string }): void;
}

interface PaddleEnvironment {
  set(env: 'sandbox' | 'production'): void;
}

interface Paddle {
  Setup(options: { vendor: number }): void;
  Checkout: PaddleCheckout;
  Environment: PaddleEnvironment;
}

declare global {
  interface Window {
    Paddle: Paddle;
  }
}
apps/web/src/components/participant-dropdown.tsx (1)

Line range hint 182-191: Consider enhancing error handling in the mutation.

While the implementation is solid, consider adding explicit error handling to provide better user feedback when the rename operation fails.

Here's a suggested improvement:

 const changeName = trpc.polls.participants.rename.useMutation({
   onSuccess: (_, { participantId, newName }) => {
     queryClient.polls.participants.invalidate();
     posthog?.capture("changed name", {
       participantId,
       oldName: props.oldName,
       newName,
     });
   },
+  onError: (error) => {
+    // You can use your preferred toast/notification system here
+    console.error('Failed to rename participant:', error.message);
+  },
 });
apps/web/src/components/discussion/discussion.tsx (1)

Line range hint 183-189: Consider increasing the staleTime for comment queries.

The current staleTime of 5 seconds might lead to unnecessary refetches for comment data that doesn't change frequently. Consider increasing this value to reduce network requests and improve performance.

  const { data: comments } = trpc.polls.comments.list.useQuery(
    { pollId },
    {
-     staleTime: 1000 * 5,
+     staleTime: 1000 * 60, // Increase to 1 minute
    },
  );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between eaab13b and 7343d83.

📒 Files selected for processing (28)
  • apps/web/src/app/[locale]/(admin)/dashboard.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/events/past-events.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/events/upcoming-events.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/billing/billing-page.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/profile/delete-account-dialog.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/profile/profile-picture.tsx (1 hunks)
  • apps/web/src/app/[locale]/(admin)/settings/profile/profile-settings.tsx (1 hunks)
  • apps/web/src/app/[locale]/(auth)/register/register-page.tsx (1 hunks)
  • apps/web/src/app/[locale]/auth/login/login-page.tsx (1 hunks)
  • apps/web/src/app/[locale]/invite/[urlId]/layout.tsx (1 hunks)
  • apps/web/src/app/providers.tsx (1 hunks)
  • apps/web/src/components/create-poll.tsx (1 hunks)
  • apps/web/src/components/discussion/discussion.tsx (1 hunks)
  • apps/web/src/components/layouts/poll-layout.tsx (1 hunks)
  • apps/web/src/components/participant-dropdown.tsx (1 hunks)
  • apps/web/src/components/participants-provider.tsx (1 hunks)
  • apps/web/src/components/poll-context.tsx (1 hunks)
  • apps/web/src/components/poll/desktop-poll/participant-row.tsx (1 hunks)
  • apps/web/src/components/poll/manage-poll/delete-poll-dialog.tsx (1 hunks)
  • apps/web/src/components/poll/mutations.ts (1 hunks)
  • apps/web/src/components/poll/notifications-toggle.tsx (1 hunks)
  • apps/web/src/components/poll/use-touch-beacon.ts (1 hunks)
  • apps/web/src/components/user-provider.tsx (1 hunks)
  • apps/web/src/contexts/plan.tsx (1 hunks)
  • apps/web/src/contexts/poll.tsx (1 hunks)
  • apps/web/src/pages/_app.tsx (1 hunks)
  • apps/web/src/trpc/client.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/web/src/components/layouts/poll-layout.tsx
  • apps/web/src/components/participants-provider.tsx
🔇 Additional comments (32)
apps/web/src/trpc/client.ts (2)

3-3: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of moving the TRPC client, maintaining consistency with similar changes across other files.


Line range hint 1-11: Clean and minimal TRPC Next.js setup.

The file maintains a clean implementation of the TRPC client using the recommended Next.js integration pattern.

Let's verify that all TRPC client imports across the codebase have been updated consistently:

✅ Verification successful

All TRPC client imports are using the new path structure consistently

The verification shows that:

  1. No occurrences of old import paths (@/utils/trpc/) were found
  2. All imports are consistently using the new path structure (@/trpc/client/)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths
# Expect: No matches as all imports should have been updated

# Search for old import paths
echo "Checking for any remaining old import paths..."
rg "@/utils/trpc/(client|config)"

# Search for new import paths to confirm the changes
echo "Verifying new import paths..."
rg "@/trpc/client/(config)?"

Length of output: 704

apps/web/src/contexts/poll.tsx (2)

4-4: LGTM! Import path updated correctly.

The import path change from @/utils/trpc/client to @/trpc/client aligns with the PR objective of moving the trpc client.


Line range hint 6-24: Implementation looks solid!

The usePoll hook implementation is well-structured with:

  • Proper error handling for missing data
  • Appropriate use of Infinity stale time for static/rarely changing data
  • Clean React hooks usage
apps/web/src/components/poll/use-touch-beacon.ts (1)

4-4: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of moving the trpc client.

Let's verify the consistency of this new import path across the codebase:

✅ Verification successful

Import path migration completed successfully

The verification confirms:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across 24 files
  • The change in use-touch-beacon.ts aligns with the project-wide migration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and confirm new import path usage
echo "Checking for any remaining old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

echo "Confirming usage of new import path..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2438

apps/web/src/app/[locale]/(admin)/events/past-events.tsx (1)

13-13: LGTM! Import path update is correct.

The import path change aligns with the PR objective of moving the trpc client to a new location. The component continues to function as expected with this structural change.

apps/web/src/app/[locale]/(admin)/events/upcoming-events.tsx (1)

13-13: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of moving the trpc client module.

Let's verify that the new import path exists:

✅ Verification successful

Import path change verified and correctly implemented

The verification confirms:

  • The new import path @/trpc/client exists at apps/web/src/trpc/client.ts
  • No files are using the old import path @/utils/trpc/client
  • Multiple files across the codebase consistently use the new import path
  • The change is part of a complete migration of the trpc client module
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new trpc client module exists and is properly exported
# Test: Check if the new path exists and exports the trpc client
fd -t f "client.ts" -p "trpc/"

# Test: Ensure no other files are still using the old import path
rg -l "@/utils/trpc/client"

Length of output: 149


Script:

#!/bin/bash
# Let's try searching without path constraints
# Find any client.ts files in the repository
fd "client.ts"

# Search for both old and new import paths
echo "Files using old import path (@/utils/trpc/client):"
rg "@/utils/trpc/client"

echo -e "\nFiles using new import path (@/trpc/client):"
rg "@/trpc/client"

# Look for trpc-related files to understand the structure
echo -e "\nAll trpc-related files:"
fd "trpc"

Length of output: 3178

apps/web/src/contexts/plan.tsx (2)

6-6: LGTM! Import path updated correctly.

The import path change aligns with the PR objective to move the trpc client.


6-6: Verify consistent trpc import usage across the codebase.

Let's ensure all trpc imports have been updated to use the new path.

✅ Verification successful

All trpc imports are consistently using the new path @/trpc/client

The verification shows that:

  • No instances of old import path @/utils/trpc/client were found
  • All 24 files consistently use the new import path @/trpc/client
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old trpc import paths and verify new ones
echo "Checking for old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

echo -e "\nVerifying new import paths..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2398

apps/web/src/app/[locale]/invite/[urlId]/layout.tsx (1)

8-8: LGTM! Import path update is consistent with module reorganization.

The change aligns with the PR objective of moving the trpc client to a new location.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification confirms that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across all files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that old import path is not used anywhere else
# and new import path is consistently used.

echo "Checking for any remaining old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

echo "Verifying consistent usage of new import path..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2458

apps/web/src/app/providers.tsx (1)

11-11: Verify consistent import path updates across the codebase.

Let's ensure all TRPC client imports have been updated consistently.

✅ Verification successful

Based on the results, I can generate the final response as we have clear evidence that:

  1. No old import paths (@/utils/trpc/) exist in the codebase
  2. The new import path (@/trpc/client/config) is used consistently in both files where it appears

Import paths have been updated consistently across the codebase

The TRPC client imports are consistent, using the new path @/trpc/client/config in both locations where it's imported:

  • apps/web/src/trpc/client.ts
  • apps/web/src/app/providers.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the old TRPC client path
# and verify that new path is used consistently.

echo "Checking for any remaining old import paths..."
rg "@/utils/trpc/(client|config)" 

echo "Verifying new import paths..."
rg "@/trpc/client/(config|index)" 

Length of output: 404

apps/web/src/components/poll/manage-poll/delete-poll-dialog.tsx (1)

13-13: LGTM! Import path update aligns with PR objectives.

The change from @/utils/trpc/client to @/trpc/client is consistent with the PR's goal of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification shows:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across all files that require the trpc client
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that old import path is not used anywhere else
# and new import path is consistently used

# Test 1: Check for any remaining old import paths
echo "Checking for old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

# Test 2: Verify consistent usage of new import path
echo "Verifying new import path usage..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2402

apps/web/src/app/[locale]/(admin)/dashboard.tsx (1)

18-18: LGTM! Verify consistent import path updates across the codebase.

The import path change aligns with the PR objective of moving the trpc client.

Let's verify that all trpc client imports have been consistently updated:

✅ Verification successful

Import path migration is complete and consistent

The verification shows that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • All imports consistently use the new path @/trpc/client across the entire application
  • The migration appears to be thorough and complete, covering all necessary files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and confirm new ones
echo "Checking for old import paths..."
rg "@/utils/trpc/client"

echo -e "\nVerifying new import paths..."
rg "@/trpc/client"

Length of output: 2822

apps/web/src/pages/_app.tsx (2)

Line range hint 89-89: Verify TRPC functionality after path change.

Since this is the main application wrapper and TRPC is critical for API communication, ensure that:

  1. All TRPC queries and mutations continue to work
  2. The development server starts without TRPC-related errors
  3. The application's API communication functions correctly
#!/bin/bash
# Description: Verify TRPC router and procedure definitions are intact

# Test 1: Check for TRPC router definitions
echo "Checking TRPC router definitions..."
rg -A 5 "createTRPCRouter|router\." 

# Test 2: Look for any TRPC procedure definitions
echo "Checking TRPC procedure definitions..."
rg -A 5 "publicProcedure|protectedProcedure"

17-17: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Based on the results from our verification scripts, I can now generate the final response:

Import path change is correctly implemented

The change from @/utils/trpc/client to @/trpc/client is consistent across the codebase:

  • The new client file exists and is properly implemented
  • Multiple files are using the new import path @/trpc/client consistently
  • No remaining references to the old import path @/utils/trpc/client were found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all imports use the new path and the old path is not used anymore

# Test 1: Check if there are any remaining imports from the old path
echo "Checking for any remaining old imports..."
rg -l "@/utils/trpc/client"

# Test 2: Verify the new import path is used consistently
echo "Verifying new import path usage..."
rg -l "@/trpc/client"

# Test 3: Verify the new path exists
echo "Verifying new path exists..."
fd "client" trpc/

Length of output: 14679


Script:

#!/bin/bash
# Let's verify the TRPC client setup and imports more specifically

# Check for the new client file location
echo "Checking for client file in new location..."
fd "client.ts" "trpc/"

# Check all imports of trpc client
echo "Checking all trpc client imports..."
rg -l "from.*trpc/client"

# Check for any remaining old imports
echo "Checking for old imports..."
rg -l "from.*utils/trpc/client"

Length of output: 1916


Script:

#!/bin/bash
# Let's verify the actual client file location and content

# Check the repository structure to find the client file
echo "Checking repository structure..."
fd -t f -d 3 . src/

# Check content of any client.ts files in the codebase
echo "Looking for and showing content of client.ts files..."
fd -t f "client.ts" . -x cat {}

Length of output: 2544

apps/web/src/app/[locale]/(admin)/settings/profile/profile-settings.tsx (1)

15-15: LGTM! Import path update aligns with module restructuring.

The change from @/utils/trpc/client to @/trpc/client is consistent with the PR's objective of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification confirms that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across all files
  • Related imports like @/trpc/client/config and @/trpc/client/types follow the same structure
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that old import path is not used anywhere else
# and new import path is consistently used

# Test 1: Check for any remaining old import paths
echo "Checking for old import paths..."
rg "@/utils/trpc/client"

# Test 2: Verify consistent usage of new import path
echo "Verifying new import paths..."
rg "@/trpc/client"

Length of output: 2816

apps/web/src/app/[locale]/auth/login/login-page.tsx (1)

11-11: LGTM! Import path update is consistent with the refactoring.

The change aligns with the PR objective of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification confirms that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across all files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all trpc client imports use the new path
# and there are no remaining references to the old path

# Test 1: Check for any remaining old import paths
echo "Checking for any remaining old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

# Test 2: Verify new import path usage
echo "Verifying new import path usage..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2430

apps/web/src/components/poll/mutations.ts (1)

2-2: LGTM! Verify import path consistency across the codebase.

The import path change aligns with the PR objective of moving the trpc client.

Let's verify that the new import path is used consistently across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification shows that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across all files that import the trpc client
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and confirm consistent usage of new path

# Test 1: Check for any remaining old import paths
echo "Checking for old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

# Test 2: Verify consistent usage of new import path
echo "Verifying new import path usage..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2402

apps/web/src/components/user-provider.tsx (1)

11-11: LGTM! Import path update is consistent with the PR objective.

The change aligns with the broader effort to move the trpc client from @/utils/trpc/client to @/trpc/client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path update is consistent across the codebase

The verification results show that:

  • No instances of the old import path @/utils/trpc/client were found
  • The new import path @/trpc/client is consistently used across 24 files in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all trpc client imports have been updated consistently
# and no old import paths remain.

# Test 1: Search for any remaining old import paths
echo "Checking for any remaining old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

# Test 2: Verify the new import path is used consistently
echo "Verifying new import path usage..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2430

apps/web/src/app/[locale]/(admin)/settings/profile/delete-account-dialog.tsx (1)

20-20: LGTM: Import path updated correctly.

The import path change aligns with the PR objective of moving the trpc client.

apps/web/src/components/poll/notifications-toggle.tsx (1)

12-12: LGTM: Import path update aligns with module reorganization

The updated import path reflects a more logical organization of the trpc client module.

apps/web/src/components/create-poll.tsx (1)

20-20: LGTM! Import path updated correctly.

The import path change aligns with the PR objective of moving the trpc client.

apps/web/src/components/poll/desktop-poll/participant-row.tsx (1)

16-16: LGTM! Import path update aligns with the trpc client restructuring.

The change is consistent with the PR objective of moving the trpc client.

Let's verify the consistency of this import path change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification confirms that:

  • No instances of the old import path @/utils/trpc/types remain in the codebase
  • The new import path @/trpc/client/types is consistently used across all files:
    • apps/web/src/components/participants-provider.tsx
    • apps/web/src/components/poll-context.tsx
    • apps/web/src/components/poll/desktop-poll/participant-row.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all imports from the old path have been updated

# Test 1: Check for any remaining imports from the old path
echo "Checking for any remaining old import paths..."
rg "@/utils/trpc/types"

# Test 2: Verify the new import path is used consistently
echo "Verifying consistency of new import path..."
rg "@/trpc/client/types"

Length of output: 553

apps/web/src/app/[locale]/(admin)/settings/profile/profile-picture.tsx (2)

Line range hint 17-182: Implementation demonstrates solid engineering practices!

The components showcase excellent practices:

  • Comprehensive error handling with user feedback
  • Proper resource cleanup
  • Type-safe file validation
  • Clear separation of concerns

12-12: LGTM! Import path update aligns with the trpc client move.

The updated import path is consistent with the PR objective of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification results show:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across 24 files
  • The change in profile-picture.tsx aligns with the project-wide migration pattern
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that old import path is not used anymore and new import path is used consistently

# Test 1: Check if there are any remaining old import paths
echo "Checking for old import paths..."
rg "from ['\"]@/utils/trpc/client['\"]"

# Test 2: Verify the new import path usage
echo "Checking new import path usage..."
rg "from ['\"]@/trpc/client['\"]"

Length of output: 2400

apps/web/src/app/[locale]/(auth)/register/register-page.tsx (1)

26-26: LGTM! Import path update aligns with PR objective.

The change from @/utils/trpc/client to @/trpc/client is consistent with the PR's goal of moving the trpc client location. The implementation remains functionally identical.

apps/web/src/app/[locale]/(admin)/polls/user-polls.tsx (1)

27-27: LGTM! Verify consistent import paths across the codebase.

The import path change aligns with the PR objective of moving the trpc client.

Let's verify the consistency of trpc import paths across the codebase:

✅ Verification successful

Import path migration is complete and consistent

The verification results show:

  • No files are using the old import path @/utils/trpc/client
  • The new import path @/trpc/client is consistently used across 28 files
  • The client file itself exists at the new location: apps/web/src/trpc/client.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and verify new import path usage

# Test 1: Check for any remaining old import paths
echo "Checking for old import paths..."
rg -l "@/utils/trpc/client"

# Test 2: Verify new import path usage
echo "Verifying new import path usage..."
rg -l "@/trpc/client"

Length of output: 1616

apps/web/src/components/poll-context.tsx (1)

8-8: LGTM! Import path updated as part of trpc client restructuring.

The import path change from @/utils/trpc/types to @/trpc/client/types aligns with the PR objective of moving the trpc client.

Let's verify that this restructuring is consistent across the codebase:

✅ Verification successful

Import path migration successfully verified across the codebase

The verification confirms that:

  • No instances of the old import path @/utils/trpc/types remain in the codebase
  • The new import path @/trpc/client/types is consistently used across related components:
    • poll-context.tsx
    • participants-provider.tsx
    • participant-row.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all imports have been updated from old to new path structure

# Test 1: Check for any remaining old import paths
echo "Checking for any remaining old import paths..."
rg -l "@/utils/trpc/types"

# Test 2: Verify new import path usage
echo "Verifying new import path usage..."
rg -l "@/trpc/client/types"

Length of output: 389

apps/web/src/app/[locale]/(admin)/settings/billing/billing-page.tsx (1)

17-17: LGTM! Import path update aligns with the PR objective.

The change from @/utils/trpc/client to @/trpc/client is consistent with the PR's goal of moving the trpc client.

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Import path change is consistent across the codebase

The verification results show that:

  • No instances of the old import path @/utils/trpc/client remain in the codebase
  • The new import path @/trpc/client is consistently used across multiple components
  • All trpc imports follow either @/trpc/client or @/app/providers pattern, which is correct as they both lead to the same client
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and confirm new path exists
echo "Checking for any remaining old imports..."
rg "@/utils/trpc/client"

echo "Verifying new path exists..."
fd "client.ts" "trpc"

echo "Checking the pattern of trpc imports across the codebase..."
rg "import.*trpc.*from" -A 1

Length of output: 5744

apps/web/src/components/participant-dropdown.tsx (1)

40-40: LGTM: Import path updated correctly.

The trpc client import path has been updated in line with the PR's objective of moving the client location.

apps/web/src/components/discussion/discussion.tsx (2)

Line range hint 89-144: LGTM! Robust implementation of comment form handling.

The mutation implementation follows best practices with proper error handling, cache invalidation, and analytics tracking.


39-39: Verify consistent TRPC client import path changes across the codebase.

The import path change aligns with the PR objective of moving the trpc client. Let's verify this change is consistent across all files.

✅ Verification successful

Import path migration is complete and consistent

The verification shows that:

  • No files are using the old import path @/utils/trpc/client
  • The new import path @/trpc/client is consistently used across 27 files
  • The change aligns with the codebase-wide migration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and verify new import path usage
echo "Checking for old import paths..."
rg -l "@/utils/trpc/client"

echo -e "\nVerifying new import path usage..."
rg -l "@/trpc/client"

Length of output: 1622

@lukevella lukevella merged commit c0c363c into main Oct 31, 2024
9 checks passed
This was referenced Oct 31, 2024
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.

1 participant