Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/components/dashboard/DemoOnboardingGate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ const shouldShowDemoOnNoApps = computed(() => {
if (path === '/login' || path === '/register' || path === '/forgot_password' || path === '/resend_email' || path === '/onboarding' || path === '/scan')
return false

if (shouldForceShowDemoOnboarding.value)
return true

return shouldShowDemoOnboarding.value && !isDemoOnboardingClosed.value
// Only show when explicitly requested via query param
return shouldForceShowDemoOnboarding.value
Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Line 58 makes the app-count fetch pipeline dead, but it still runs on every init/org change.

Since :open now depends on shouldShowDemoOnNoApps -> shouldForceShowDemoOnboarding, fetchAppsCount()/hasNoApps/shouldShowDemoOnboarding no longer affect rendering, yet Supabase apps count queries still execute. This adds avoidable backend load and noisy error paths.

♻️ Proposed cleanup (minimal, behavior-preserving)
 async function initDemoOnboarding() {
   await organizationStore.awaitInitialLoad()
-  updateDemoOnboardingState()
-  await fetchAppsCount()
 }
 
-watch(currentOrganization, async () => {
-  await initDemoOnboarding()
-})
+// No org-dependent app-count fetch needed for query-param-only gating.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/dashboard/DemoOnboardingGate.vue` around lines 57 - 58, The
app-count fetch pipeline is running unnecessarily because :open now depends only
on shouldForceShowDemoOnboarding, making
fetchAppsCount/hasNoApps/shouldShowDemoOnboarding dead for render while still
executing; update the code so fetchAppsCount (and any watcher/effect that calls
it on init/org change) is short-circuited when
shouldForceShowDemoOnboarding.value is true — e.g., add a guard in the
initialization/watcher that checks shouldForceShowDemoOnboarding before invoking
fetchAppsCount or computing hasNoApps, or remove the unused reactive dependency
in shouldShowDemoOnboarding and relocate fetchAppsCount to only run when the
non-forced path is active, ensuring Supabase queries are skipped when forced
demo onboarding is enabled.

})

function updateDemoOnboardingState() {
Expand Down