Skip to content

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Oct 26, 2025

No description provided.

@vercel
Copy link

vercel bot commented Oct 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rivet-inspector Ready Ready Preview Comment Oct 26, 2025 10:51pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Oct 26, 2025 10:51pm
rivet-site Ignored Ignored Preview Oct 26, 2025 10:51pm

@jog1t jog1t marked this pull request as ready for review October 26, 2025 22:49
Copy link
Contributor Author

jog1t commented Oct 26, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 26, 2025

Graphite Automations

"Test" took an action on this PR • (10/26/25)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

@claude
Copy link

claude bot commented Oct 26, 2025

PR Review: Fix redirect engine users to connect page when there's no actors

Overview

This PR adds the same redirect logic that exists for the cloud route to the engine route, ensuring engine users are also redirected to the connect page when there are no actors (builds or runner configs). Good consistency improvement!

✅ Positives

  1. Code Reuse: Excellent extraction of shouldDisplayActors into a shared export with proper TypeScript typing.
  2. Consistency: Engine route now matches the cloud route's behavior, providing a better UX.
  3. Type Safety: The explicit type annotation on shouldDisplayActors is well-defined and makes the contract clear.
  4. Clean Refactoring: The removal of unnecessary fragment wrapper in the cloud route component improves code clarity.

🔍 Observations & Suggestions

1. Type Definition Location (Minor)

The shouldDisplayActors function is exported from the cloud route file but used by the engine route. While this works, consider:

  • Current approach: Engine imports from cloud route (tight coupling)
  • Alternative: Move to a shared utility file (e.g., /frontend/src/utils/actors.ts or /frontend/src/lib/route-utils.ts)

This would make the dependency relationship clearer and avoid route-to-route imports.

Example:

// frontend/src/lib/route-utils.ts
import type { QueryClient } from "@tanstack/react-query";
import type { useEngineCompatDataProvider } from "@/components/actors";

export async function shouldDisplayActors(context: {
  queryClient: QueryClient;
  dataProvider: ReturnType<typeof useEngineCompatDataProvider>;
}) {
  // ... existing implementation
}

2. Return Value Semantics (Minor)

The function returns true | undefined instead of boolean. While this works with the redirect condition (if (!shouldDisplay)), it's semantically unclear:

if (!hasBuilds && !hasRunnerConfigs) {
  return undefined;  // Why undefined instead of false?
}
return true;

Suggestion: Return false instead of undefined for clarity, or document why undefined is intentional:

// If no builds or configs, don't display actors page
if (!hasBuilds && !hasRunnerConfigs) {
  return false;
}
return true;

3. Error Handling Consistency

The function has a catch-all that returns undefined:

} catch {
  return undefined;
}

This means any error (network failure, permission issue, etc.) will redirect to the connect page. Consider:

  • Is this the desired behavior for all error types?
  • Should certain errors be logged for debugging?
  • Would it be better to let some errors propagate?

Suggestion: Add minimal logging for production debugging:

} catch (error) {
  tracing::warn!(?error, "failed to check if actors should display");
  return undefined;
}

Wait, this is TypeScript, not Rust! 😄

} catch (error) {
  console.warn("Failed to check if actors should display", error);
  return false;
}

4. Missing Test Coverage (Medium Priority)

There don't appear to be any tests for:

  • The shouldDisplayActors function
  • The redirect behavior in beforeLoad
  • Edge cases (empty pages, network errors, etc.)

Suggestion: Add tests for this routing logic to prevent regressions.

5. Fragment Removal (Nitpick)

Nice cleanup removing the unnecessary fragment in frontend/src/routes/_context/_cloud/orgs.$organization/projects.$project/ns.$namespace/index.tsx:73-74! However, the engine route still has a fragment wrapper (line 30-39 in the new version). Consider applying the same cleanup there for consistency.

🐛 Potential Issues

None identified - the code appears functionally correct.

🔒 Security Considerations

No concerns - this is client-side routing logic with no security implications.

⚡ Performance Considerations

The beforeLoad hook will make two API calls (fetchInfiniteQuery for builds and runner configs) on every navigation to these routes. This is acceptable for routing decisions, but be aware:

  • These queries are necessary to determine if redirect is needed
  • The queries should be cached by React Query, minimizing performance impact
  • Consider if the 5000ms refetchInterval in the connect page could conflict with the cache

📝 Summary

Recommendation: Approve with minor suggestions

This is a solid PR that improves consistency between cloud and engine routes. The code is functional and well-structured. The suggestions above are minor improvements for code organization and clarity, not blockers.

Action Items (Optional):

  • Consider moving shouldDisplayActors to a shared utilities file
  • Change undefined return to false for clarity
  • Add test coverage for the redirect logic
  • Apply the fragment cleanup to the engine route as well

Great work! 🚀

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 26, 2025

More templates

@rivetkit/actor

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/actor@3269

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@3269

@rivetkit/core

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/core@3269

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@3269

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@3269

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@3269

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@3269

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@3269

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@3269

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@3269

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@3269

commit: c352b7a

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