-
Couldn't load subscription status.
- Fork 130
fix(fe): redirect engine users to connect page when there's no actors #3269
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
fix(fe): redirect engine users to connect page when there's no actors #3269
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
How to use the Graphite Merge QueueAdd 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 Automations"Test" took an action on this PR • (10/26/25)1 assignee was added to this PR based on Kacper Wojciechowski's automation. |
PR Review: Fix redirect engine users to connect page when there's no actorsOverviewThis 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
🔍 Observations & Suggestions1. Type Definition Location (Minor)The
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 if (!hasBuilds && !hasRunnerConfigs) {
return undefined; // Why undefined instead of false?
}
return true;Suggestion: Return // If no builds or configs, don't display actors page
if (!hasBuilds && !hasRunnerConfigs) {
return false;
}
return true;3. Error Handling ConsistencyThe function has a catch-all that returns } catch {
return undefined;
}This means any error (network failure, permission issue, etc.) will redirect to the connect page. Consider:
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:
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 IssuesNone identified - the code appears functionally correct. 🔒 Security ConsiderationsNo concerns - this is client-side routing logic with no security implications. ⚡ Performance ConsiderationsThe
📝 SummaryRecommendation: 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):
Great work! 🚀 |
More templates
@rivetkit/actor
@rivetkit/cloudflare-workers
@rivetkit/core
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
c352b7a to
c22f51f
Compare
31cd0a4 to
03bc5d3
Compare
Code Review - PR #3269SummaryThis PR adds redirect logic for engine users to the connect page when there are no actors, bringing parity with the cloud route behavior. ✅ Positive Aspects
🐛 Issues & Concerns1. Type Safety Concern (Medium Priority)The Location: Issue: If the engine context doesn't have the exact same shape as the cloud context, this will fail at runtime. TypeScript won't catch this because the context type is checked at the route level ( Recommendation: Either:
2. Return Type Inconsistency (Low Priority)The function returns Location: if (!hasBuilds && !hasRunnerConfigs) {
return undefined; // This seems odd
}
return true;Issue: The function returns Recommendation: Consider returning 3. Missing Error Handling Context (Low Priority)The catch block silently returns Location: Issue: If the query fails, there's no indication of what went wrong, making debugging difficult. Recommendation: Add logging or error tracking: } catch (error) {
console.error('Failed to check for actors:', error);
return undefined;
}4. Import Organization (Style)The import is using a relative path that goes up multiple levels. Location: import { shouldDisplayActors } from "../../_cloud/orgs.$organization/projects.$project/ns.$namespace/index";Issue: This creates coupling between engine and cloud routes. If the cloud route moves, the engine route breaks. Recommendation: Consider moving 🔒 Security ConsiderationsNo security concerns identified. The redirect logic is client-side only and doesn't expose sensitive data. ⚡ Performance ConsiderationsPotential N+1 Query Issue: The function fetches infinite queries for both builds and runner configs on every route load. This happens in Impact: Acceptable for now, but consider:
🧪 Test CoverageMissing: No tests found for this logic. Recommendation: Add tests for:
📝 Additional Suggestions
export type ActorDisplayContext = {
queryClient: QueryClient;
dataProvider: ReturnType<typeof useEngineCompatDataProvider>;
};
/**
* Determines if the actors page should be displayed based on
* whether there are any builds or runner configs available.
* Redirects to the connect page if neither exist.
*
* @returns true if actors should be displayed, undefined otherwise
*/
export async function shouldDisplayActors(/* ... */) {📊 Overall AssessmentCode Quality: ✅ Good This is a solid PR that achieves its goal. The main concerns are around type safety and code organization. Consider addressing the type safety issue before merging. |
Code Review: PR #3269 - Redirect engine users to connect page when there's no actorsSummaryThis PR adds logic to redirect users to the connect page when they don't have any builds or runner configs. The implementation shares the Positive Aspects
Issues & Concerns1. Type Safety Concern (High Priority)The Location: const shouldDisplay = await shouldDisplayActors(context);The engine context may not have the exact same shape as the cloud context. Looking at the route definitions:
Recommendation: Verify that the engine context at the index route level has access to 2. Inconsistent Error Handling (Medium Priority)The if (!shouldDisplay) {
throw redirect({ from: Route.to, replace: true, to: "./connect" });
}This means that if there's an error fetching builds/configs, users will be redirected to the connect page, which may not be the intended behavior. Errors could occur due to network issues, permission problems, etc. Recommendation: Consider differentiating between "no actors" (should redirect) and "error checking for actors" (should show error or retry). Perhaps:
3. Inconsistent Return Values (Low Priority)The function returns if (!hasBuilds && !hasRunnerConfigs) {
return undefined; // No actors
}
return true; // Has actors
// catch block also returns undefined // Error caseRecommendation: Use boolean values consistently ( 4. Missing CatchBoundary in Engine Route (Low Priority)The cloud route wraps Location: The cloud route has: <CatchBoundary getResetKey={() => actorId ?? "no-actor-id"}>
<Actors actorId={actorId} />
<CatchBoundary ...>
{!n ? <BuildPrefiller /> : null}
</CatchBoundary>
</CatchBoundary>But the engine route has: <>
<Actors actorId={actorId} />
<CatchBoundary ...>
{!n ? <BuildPrefiller /> : null}
</CatchBoundary>
</>Recommendation: Add the outer Testing RecommendationsSince there are no test files for these routes, consider manual testing:
Security & Performance
Style & Convention NotesAccording to CLAUDE.md, the codebase uses:
RecommendationApprove with minor changes suggested. The main concern is ensuring type safety for the engine context. I'd recommend:
Great work on the code reuse and maintaining consistency between cloud and engine experiences! |
c22f51f to
fb4f216
Compare
PR Review: Redirect engine users to connect page when there's no actorsOverviewThis PR adds redirect logic to the engine route to match the existing cloud route behavior, ensuring users without actors/builds are redirected to the connect page. Overall the implementation looks good, but I've identified a few areas for improvement. Code Quality & Best Practices✅ Positive Points
|

No description provided.