Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(web): remove stale no-nested-ternary disable in useReadPath (#19491)

cursor[bot]714654fd2c86
diff --git a/web/src/features/events/hooks/useReadPath.ts b/web/src/features/events/hooks/useReadPath.ts
index d3988cfba1..5c573bcf9f 100644
--- a/web/src/features/events/hooks/useReadPath.ts
+++ b/web/src/features/events/hooks/useReadPath.ts
@@ -1,4 +1,3 @@
-/* eslint-disable no-nested-ternary */
import { useSession } from "next-auth/react";
/** The events read path a data-fetching surface must use. */
@@ -25,13 +24,18 @@ export function useReadPath(): {
// A session re-check reports "loading" with the previous session still in
// hand — that keeps the resolved path. Only a cold load is unknown.
- const readPath: ReadPath = session?.user
- ? session.user.v4BetaEnabled === true
- ? "v4"
- : "v3"
- : status === "loading"
- ? "unknown"
- : "v3";
+ const readPath = ((): ReadPath => {
+ if (session?.user?.v4BetaEnabled === true) {
+ return "v4";
+ }
+ if (session?.user) {
+ return "v3";
+ }
+ if (status === "loading") {
+ return "unknown";
+ }
+ return "v3";
+ })();
return {
readPath,