Skip to content

Vue <script setup> calls to Nuxt auto-imported composables aren't linked #2473

Closed

Description

@gavinwilliams

Version: codegraph 1.6.2, macOS arm64 (bundled runtime)

Project: Nuxt 4 SPA (srcDir: app/) in a pnpm monorepo, with composables auto-imported from app/composables/ and a few extra imports.dirs.

What happens

A composable such as app/composables/usePermissions.ts:

export function usePermissions() {
  /* ... */
}

is called without an import (Nuxt auto-import) from both .ts composables and .vue components:

<script setup lang="ts">
const { hasPermission, loaded } = usePermissions();
</script>

codegraph callers usePermissions lists every .ts caller (14 of 14) but none of the .vue callers (0 of 5). For a composable called only from .ts files, every caller is found (34 of 34).

A .vue file that imports the composable explicitly (import { useSidebarState } from "~/composables/useSidebarState") is linked, so the gap is auto-imported calls from .vue <script setup> only.

Expected

.vue files that call an auto-imported composable appear as callers, the same as .ts files, so impact and the blast radius in codegraph_explore include the components that use it.

Why it matters

In a Nuxt app most components call composables at the top of <script setup> (about 75 components in ours), so the blast radius of a composable change misses the components.

Activity

  1. JiaMingWang-CN commented on Oct 22, 2026

    @JiaMingWang-CN

    This looks like a duplicate of #2340, already fixed on main by #2357 (8998697, merged 2026-10-05, after 1.6.2 was released on 10-03). It hasn't been released yet.

    The trigger isn't the auto-import itself. A destructuring declaration at the top of <script setup> (const { hasPermission, loaded } = usePermissions()) dropped its initializer's call, so a plain const perms = usePermissions(), or the same call inside a function, was linked even on 1.6.2.

    Minimal Nuxt 4 repro (srcDir: 'app/', usePermissions exported from app/composables/usePermissions.ts). codegraph callers usePermissions:

    caller shape v1.6.2 8998697^ 8998697 / main (e69546e)
    PermGate.vue top-level destructuring, auto-imported missing missing found
    PermGateImported.vue top-level destructuring, explicit import imports edge only imports edge only found
    PermGateJs.vue const perms = usePermissions() found found found
    pages/index.vue call inside a function found found found
    composables/useAdmin.ts .ts caller found found found

    So this can probably be closed once the next release ships.

  2. colbymchenry commented on Oct 22, 2026

    @colbymchenry
    Owner

    Thanks for the clear report! This is fixed on main by #2357. It links calls in a destructuring declaration at the top of <script setup>, like const { hasPermission, loaded } = usePermissions(), which was the shape dropping your .vue callers (as @JiaMingWang-CN worked out).

    We rebuilt your setup as a Nuxt 4 fixture with an auto-imported composable. On current main, codegraph callers usePermissions lists every .vue and .ts caller, while the build just before #2357 misses the components. It was merged after 1.6.2, so it ships in the next release; re-index your project after upgrading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions