Skip to content

Properly type lastSubmission instead of using any #2210

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ytoshiki
Copy link

@ytoshiki ytoshiki commented Jun 29, 2025

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

  • Tested form validation and submission with valid and invalid data with JavaScript disabled.
  • Confirmed that typed action data is correctly handled without errors.

Changelog

  • Changed action response from json to typedjson.
  • Added proper typing for useTypedActionData.
  • Improved form submission result handling with isSubmissionResult utility.

Screenshots

image

Copy link

changeset-bot bot commented Jun 29, 2025

⚠️ No Changeset found

Latest commit: 22472c3

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.

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 Jun 29, 2025

Walkthrough

This set of changes refactors form submission and action data handling across multiple routes in the web application. The updates replace Remix's standard json and useActionData utilities with typedjson and useTypedActionData from the remix-typedjson package, and update action function signatures to use ActionFunctionArgs for improved type safety. A new utility function, isSubmissionResult, is introduced to validate that received action data conforms to the expected submission result structure before passing it to form hooks. These modifications affect both server-side action handlers and client-side components, ensuring consistent and type-safe handling of form submission results throughout the application. No core logic or control flow is altered.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc568e7 and 22472c3.

📒 Files selected for processing (17)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.invite/route.tsx (5 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx (6 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx (9 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new/route.tsx (7 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx (10 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx (6 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx (7 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings._index/route.tsx (6 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx (6 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new/route.tsx (5 hunks)
  • apps/webapp/app/routes/_app.orgs.new/route.tsx (4 hunks)
  • apps/webapp/app/routes/account._index/route.tsx (5 hunks)
  • apps/webapp/app/routes/account.tokens/route.tsx (7 hunks)
  • apps/webapp/app/routes/confirm-basic-details.tsx (6 hunks)
  • apps/webapp/app/routes/invites.tsx (4 hunks)
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.new/route.tsx (5 hunks)
  • apps/webapp/app/utils/conformTo.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/webapp/**/*`: The webapp at apps/webapp is a Remix 2.1 app that uses Node.js v20. Use zod extensively in the webapp.

apps/webapp/**/*: The webapp at apps/webapp is a Remix 2.1 app that uses Node.js v20.
Use zod extensively in the webapp.

📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md)

List of files the instruction was applied to:

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new/route.tsx
  • apps/webapp/app/utils/conformTo.ts
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx
  • apps/webapp/app/routes/invites.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx
  • apps/webapp/app/routes/_app.orgs.new/route.tsx
  • apps/webapp/app/routes/confirm-basic-details.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.invite/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings._index/route.tsx
  • apps/webapp/app/routes/account.tokens/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx
  • apps/webapp/app/routes/account._index/route.tsx
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.new/route.tsx
🧠 Learnings (16)
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx (4)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-24T08:06:17.013Z
Learning: Always prefer using isomorphic code (such as fetch, ReadableStream, etc.) instead of Node.js specific code in TypeScript projects, especially for SDKs intended to run in multiple environments.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new/route.tsx (4)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: Use 'presenters' (located in app/v3/presenters/**/*.server.ts) to encapsulate complex loader logic into classes, improving code organization and testability.
apps/webapp/app/utils/conformTo.ts (2)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx (6)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When implementing Trigger.dev tasks in files under '**/trigger/**/*.{ts,tsx,js,jsx}', always import from '@trigger.dev/sdk/v3' and export every task, including subtasks, to ensure correct discovery and execution.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
apps/webapp/app/routes/invites.tsx (3)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When implementing Trigger.dev tasks in files under '**/trigger/**/*.{ts,tsx,js,jsx}', always import from '@trigger.dev/sdk/v3' and export every task, including subtasks, to ensure correct discovery and execution.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: Use 'presenters' (located in app/v3/presenters/**/*.server.ts) to encapsulate complex loader logic into classes, improving code organization and testability.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx (3)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When implementing Trigger.dev tasks in files under '**/trigger/**/*.{ts,tsx,js,jsx}', always import from '@trigger.dev/sdk/v3' and export every task, including subtasks, to ensure correct discovery and execution.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
apps/webapp/app/routes/_app.orgs.new/route.tsx (2)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
apps/webapp/app/routes/confirm-basic-details.tsx (2)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new/route.tsx (3)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When implementing Trigger.dev tasks in files under '**/trigger/**/*.{ts,tsx,js,jsx}', always import from '@trigger.dev/sdk/v3' and export every task, including subtasks, to ensure correct discovery and execution.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: Use 'presenters' (located in app/v3/presenters/**/*.server.ts) to encapsulate complex loader logic into classes, improving code organization and testability.
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings._index/route.tsx (1)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
apps/webapp/app/routes/account.tokens/route.tsx (3)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: In Next.js App Router, pass the public access token to the frontend using cookies, query parameters, or server-side generation to enable authenticated access to run data.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx (4)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: nicktrn
PR: triggerdotdev/trigger.dev#1424
File: apps/webapp/app/v3/failedTaskRun.server.ts:136-139
Timestamp: 2024-10-22T10:34:42.602Z
Learning: In the `apps/webapp` project, it's acceptable to use private class methods with `#` syntax in TypeScript code.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: For data validation in the webapp, utilize Zod schemas provided by @trigger.dev/core subpath exports.
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx (2)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx (10)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When implementing Trigger.dev tasks in files under '**/trigger/**/*.{ts,tsx,js,jsx}', always import from '@trigger.dev/sdk/v3' and export every task, including subtasks, to ensure correct discovery and execution.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: When writing tests in the webapp (apps/webapp/app/**/*.test.{ts,tsx}), avoid importing env.server.ts directly or indirectly; instead, ensure that all dependencies are testable and receive configuration via options, not environment variables.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Incorrect implementation of Trigger.dev tasks (wrong imports, missing exports, deprecated patterns) will break production, fail deployment, and fail to run locally.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Before generating any Trigger.dev task code, always verify: (1) imports are from '@trigger.dev/sdk/v3', (2) every task is exported, and (3) no deprecated code patterns are present.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: Use 'presenters' (located in app/v3/presenters/**/*.server.ts) to encapsulate complex loader logic into classes, improving code organization and testability.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Files with '.test' or '.spec' in their names are automatically excluded from task discovery, but this can be customized with 'ignorePatterns' in 'trigger.config.ts'.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: When triggering tasks from backend code, use 'tasks.trigger', 'tasks.batchTrigger', or 'tasks.triggerAndPoll' from '@trigger.dev/sdk/v3', and use type-only imports for type safety.
apps/webapp/app/routes/account._index/route.tsx (1)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.new/route.tsx (4)
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-06-24T08:06:34.164Z
Learning: In the Remix 2.1.0 webapp (apps/webapp), all environment variables must be accessed via the 'env' export from env.server.ts, never directly from process.env, to ensure consistent and secure environment management.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For React frontends, use '@trigger.dev/react-hooks' and provide the public access token via context or props; prefer Realtime hooks over SWR hooks for live updates.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: For scheduled (cron) tasks, use 'schedules.task' from '@trigger.dev/sdk/v3' and specify the 'cron' property, optionally with a timezone.
Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-06-24T08:07:10.028Z
Learning: Schema-validated tasks should use 'schemaTask' from '@trigger.dev/sdk/v3' and a schema validator like Zod to enforce payload structure and types.
🧬 Code Graph Analysis (4)
apps/webapp/app/routes/invites.tsx (2)
apps/webapp/app/services/session.server.ts (1)
  • requireUserId (25-35)
apps/webapp/app/utils/conformTo.ts (1)
  • isSubmissionResult (11-13)
apps/webapp/app/routes/confirm-basic-details.tsx (2)
apps/webapp/app/utils/conformTo.ts (1)
  • isSubmissionResult (11-13)
apps/webapp/app/hooks/useFeatures.ts (1)
  • useFeatures (5-9)
apps/webapp/app/routes/_app.orgs.$organizationSlug.invite/route.tsx (3)
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx (2)
  • action (98-129)
  • loader (68-92)
apps/webapp/app/hooks/useOrganizations.ts (1)
  • useOrganization (39-43)
apps/webapp/app/utils/conformTo.ts (1)
  • isSubmissionResult (11-13)
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx (4)
apps/webapp/app/routes/_app.orgs.$organizationSlug.invite/route.tsx (1)
  • action (79-122)
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings._index/route.tsx (1)
  • action (138-237)
apps/webapp/app/routes/_app.orgs.new/route.tsx (1)
  • action (46-76)
apps/webapp/app/utils/conformTo.ts (1)
  • isSubmissionResult (11-13)
🔇 Additional comments (61)
apps/webapp/app/utils/conformTo.ts (1)

1-13: LGTM! Well-implemented type guard utility.

The isSubmissionResult function properly validates the Submission type structure using Zod. The schema accurately reflects the expected properties from @conform-to/react's Submission interface, and the type guard implementation using safeParse().success is the correct approach for runtime type checking.

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx (6)

12-12: Import changes improve type safety.

Correctly removed useActionData from imports as it's being replaced with the typed equivalent.


19-19: Added typed utilities for better form handling.

The addition of useTypedActionData from remix-typedjson provides type-safe action data consumption.


73-73: Type guard utility properly imported.

The isSubmissionResult import enables safe type checking of submission results.


129-129: Consistent use of typed JSON responses.

Replacing json() with typedjson() ensures type-safe serialization of submission results.


420-421: Excellent type safety improvement.

The type guard check replaces unsafe type casting with proper runtime validation. This ensures lastSubmission is only used when it conforms to the expected Submission interface, eliminating potential runtime errors.


504-506: Consistent type guard implementation.

The same safe pattern is applied here, ensuring type safety across all form components in this route.

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new/route.tsx (3)

15-15: Consistent migration to typed utilities.

The import changes align with the broader type safety improvements across the codebase.


131-131: Type-safe JSON serialization.

Consistent use of typedjson() for form submission responses.


185-186: Safe type validation for form submissions.

The type guard pattern is consistently applied, ensuring lastSubmission is properly validated before use in the form hook.

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx (3)

9-9: Typed utilities correctly imported.

The addition of useTypedActionData and typedjson supports the type safety improvements.


184-184: Type-safe response handling.

Consistent use of typedjson() for submission validation failures.


216-217: Proper type validation implementation.

The type guard check ensures safe handling of action data, eliminating the need for unsafe type assertions.

apps/webapp/app/routes/invites.tsx (4)

3-5: Complete import migration for type safety.

The import changes correctly replace generic Remix utilities with their typed equivalents from remix-typedjson, improving type safety throughout the form handling pipeline.


38-38: Improved action function typing.

The explicit ActionFunctionArgs typing provides better type safety for the action handler parameters.


45-45: Type-safe submission response.

Using typedjson() ensures proper typing of validation failure responses.


91-92: Excellent elimination of unsafe type casting.

The type guard check replaces what was likely an as any cast with proper runtime validation, significantly improving type safety and reducing potential runtime errors.

apps/webapp/app/routes/_app.orgs.$organizationSlug_.projects.new/route.tsx (4)

4-6: LGTM: Import changes correctly establish typed utilities

The import updates properly replace Remix's standard utilities with their typed counterparts from remix-typedjson, and add the isSubmissionResult utility for runtime type validation.

Also applies to: 32-32


92-92: LGTM: Action function properly typed

The function signature change from ActionFunction to explicit ActionFunctionArgs provides better type safety for the action parameters.


101-101: LGTM: Consistent use of typedjson for responses

All JSON responses now use typedjson instead of json, ensuring type-safe serialization for both validation failures and error cases.

Also applies to: 118-118


125-126: LGTM: Type-safe action data handling with runtime validation

The implementation correctly uses useTypedActionData and applies the isSubmissionResult type guard to ensure the submission data matches the expected shape before passing to the form hook. This eliminates the previous unsafe type casting.

Also applies to: 132-132

apps/webapp/app/routes/_app.orgs.new/route.tsx (3)

5-8: LGTM: Consistent import pattern applied

The import changes correctly follow the established pattern, replacing standard Remix utilities with typed variants and adding the isSubmissionResult utility.

Also applies to: 28-28


46-46: LGTM: Type safety improvements consistently applied

The action function signature and JSON responses are updated following the same pattern as other routes, ensuring consistent type safety across the codebase.

Also applies to: 52-52, 74-74


80-81: LGTM: Runtime type validation properly implemented

The typed action data handling with isSubmissionResult validation follows the established pattern and ensures type safety at runtime.

Also applies to: 87-87

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx (3)

4-12: LGTM: Import updates include additional typing utilities

The imports correctly add typed utilities and include UseDataFunctionReturn for additional type safety. The isSubmissionResult utility is properly imported for form validation.

Also applies to: 54-54


98-98: LGTM: Server-side type safety improvements applied

The action function and JSON responses follow the established pattern, ensuring consistent type safety across server-side form handling.

Also applies to: 107-107, 127-127


327-328: LGTM: Modal component properly implements typed action data

The LeaveTeamModal component correctly implements the typed action data pattern with runtime validation, demonstrating proper usage in nested components.

Also applies to: 332-332

apps/webapp/app/routes/confirm-basic-details.tsx (3)

5-6: LGTM: Import changes follow established pattern

The imports correctly replace standard utilities with typed variants. The relative import path for isSubmissionResult is appropriate for this file's location.

Also applies to: 9-9, 28-28


71-71: LGTM: Type safety improvements consistently implemented

The action function signature and JSON responses follow the established pattern, maintaining consistency across the codebase's type safety improvements.

Also applies to: 98-98, 111-111


127-128: LGTM: Client-side typed action data properly handled

The implementation of useTypedActionData with isSubmissionResult validation follows the established pattern and ensures runtime type safety for form submissions.

Also applies to: 135-135

apps/webapp/app/routes/account._index/route.tsx (3)

4-6: LGTM: Final file completes consistent import pattern

The import changes follow the established pattern perfectly, completing the type safety improvements across all reviewed routes.

Also applies to: 32-32


80-80: LGTM: Server-side changes maintain consistency

The action function and JSON response updates follow the established pattern, ensuring type safety is consistently applied across all form handling routes.

Also applies to: 108-108, 125-125


131-132: LGTM: Type-safe action data handling consistently implemented

The final implementation of typed action data with runtime validation completes the consistent refactoring pattern across all reviewed files. This eliminates unsafe type casting and improves overall type safety.

Also applies to: 136-136

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx (3)

13-18: LGTM! Excellent type safety improvements.

The import changes correctly replace Remix's generic utilities with their typed counterparts from remix-typedjson, and the addition of isSubmissionResult utility enhances type safety.

Also applies to: 66-66


120-120: Correct usage of typed JSON responses.

Replacing json with typedjson ensures consistent typed responses throughout the action handler.

Also applies to: 127-127


359-361: Well-implemented type guard pattern.

The use of isSubmissionResult as a type guard before passing to useForm eliminates the need for unsafe type casting and ensures type safety.

Also applies to: 371-371

apps/webapp/app/routes/account.tokens/route.tsx (4)

6-13: Consistent import updates for type safety.

The imports correctly replace Remix utilities with their typed counterparts, following the established pattern across the codebase.

Also applies to: 52-52


98-98: Proper typing of action function and responses.

The action function signature and all JSON responses are correctly updated to use typed variants, ensuring consistent type safety.

Also applies to: 104-104, 115-115, 117-117, 130-130, 134-134


221-222: Excellent use of typed fetcher with type guard.

The combination of useTypedFetcher and isSubmissionResult type guard provides robust type safety for form submission handling.

Also applies to: 226-226


294-295: Consistent type safety pattern.

The same type guard pattern is correctly applied for action data handling, maintaining consistency across components.

Also applies to: 299-299

apps/webapp/app/routes/_app.orgs.$organizationSlug.invite/route.tsx (3)

4-7: Consistent type safety import pattern.

The import changes align with the broader refactoring effort to improve type safety across the application.

Also applies to: 31-31


79-79: Proper action function typing and responses.

The action function signature and responses are correctly updated to use typed variants, maintaining consistency with the refactoring pattern.

Also applies to: 88-88, 120-120


129-130: Effective type guard implementation.

The use of isSubmissionResult type guard ensures type safety when passing action data to form hooks, eliminating unsafe type assertions.

Also applies to: 134-134

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules.new/route.tsx (3)

4-5: Correct import updates for typed utilities.

The imports are properly updated to use typed variants from remix-typedjson and include the necessary type guard utility.

Also applies to: 57-58


77-77: Consistent typed response pattern.

The action function correctly uses typedjson for error responses, maintaining consistency with the broader type safety improvements.


137-138: Proper type guard usage in form component.

The implementation correctly applies the isSubmissionResult type guard before passing action data to the form hook, ensuring type safety.

Also applies to: 152-152

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings._index/route.tsx (3)

10-12: Consistent type safety improvements.

The import changes correctly adopt typed utilities from remix-typedjson and include the necessary type guard, following the established pattern.

Also applies to: 61-61


138-138: Comprehensive typed response implementation.

The action function signature and all response paths are correctly updated to use typed variants, ensuring consistent type safety throughout the handler.

Also applies to: 142-142, 154-154, 235-235


241-242: Effective type guard application for multiple forms.

The type guard pattern is correctly applied and both form hooks receive properly typed submission data, eliminating unsafe type assertions.

Also applies to: 247-247, 258-258

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx (6)

4-6: Excellent type safety improvements!

The import updates properly replace untyped Remix utilities with their typed counterparts from remix-typedjson. The removal of unused imports and addition of ActionFunctionArgs enhances type safety.


36-36: Good addition of the type guard utility.

Adding the isSubmissionResult import enables proper validation of action data before using it in form hooks, preventing potential runtime errors from invalid data shapes.


80-80: Proper action function signature update.

Updating from the deprecated ActionFunction type to ActionFunctionArgs improves type safety and follows current Remix best practices.


84-84: Consistent use of typedjson for all responses.

All JSON responses now use typedjson instead of json, ensuring consistent type-safe serialization throughout the action function.

Also applies to: 97-97, 148-148


154-156: Excellent type-safe action data handling.

The implementation properly:

  • Uses useTypedActionData<typeof action>() for type inference
  • Applies the isSubmissionResult type guard to validate data shape
  • Defaults to undefined when validation fails

This eliminates unsafe type assertions while maintaining type safety.


162-162: Proper form hook integration.

Both rename and delete forms now receive the properly typed and validated lastSubmission data, ensuring type safety throughout the form handling pipeline.

Also applies to: 177-177

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam/route.tsx (6)

4-5: Consistent import updates for type safety.

The import changes mirror the pattern from the settings route, replacing untyped utilities with their typed counterparts and updating the action function signature type.

Also applies to: 8-8


56-56: Proper utility import for data validation.

Adding the isSubmissionResult import ensures consistent validation of action data across the application.


97-97: Type-safe action implementation.

The action function signature update and consistent use of typedjson for form validation failures maintains the established type safety pattern.

Also applies to: 105-105


194-195: Excellent StandardTaskForm type safety.

The StandardTaskForm component properly implements the type-safe action data pattern:

  • Uses useTypedActionData<typeof action>()
  • Validates with isSubmissionResult
  • Provides fallback to undefined

369-370: Consistent ScheduledTaskForm implementation.

The ScheduledTaskForm component follows the exact same type-safe pattern as StandardTaskForm, ensuring consistency across all form components in the route.


243-243: Proper form hook integration.

Both form components now receive the validated lastSubmission data, completing the type-safe form handling pipeline from server to client.

Also applies to: 404-404

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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