Skip to content

feat(vue-router): add styles to Vue RouteMatchExtensions augmentation #7318

Open

Description

@coderabbitai

Summary

The RouteMatchExtensions interface in packages/vue-router/src/Matches.tsx is missing a styles field, unlike the React and Solid counterparts which include it.

This gap pre-dates PR #7311 (feat: add support for deferred head loading), which added key?: string support to the existing fields but did not introduce the missing styles entry for Vue.

Required Change

Add the following field to the RouteMatchExtensions module augmentation in packages/vue-router/src/Matches.tsx:

styles?: Array<
  (Vue.ComponentOptions['style'] & { key?: string }) | undefined
>

This should be placed alongside meta, links, scripts, and headScripts to match the React/Solid augmentations and provide full type coverage for keyed/deferred head().styles in Vue.

References

/cc @romulovalez

Activity

  1. romulovalez commented on May 2, 2026

    @romulovalez

    codeRabbit didn't get it completely right, it mixed with the changes from my PR, the required change should be this:

    styles?: Array<Vue.ComponentOptions['style'] | undefined>

    And we need to introduce this block on headContentUtils.ts:

     const styles = Vue.computed<Array<RouterManagedTag>>(() =>
        (
          matches.value
            .map((match) => match.styles!)
            .flat(1)
            .filter(Boolean) as Array<RouterManagedTag>
        ).map(({ children, ...style }) => ({
          tag: 'style',
          attrs: {
            ...style,
          },
          children,
        })),
      )

    and spread styles.value on the return

  2. schiller-manuel commented on May 2, 2026

    @schiller-manuel
    Collaborator

    why is this issue opened at all? what triggered this?

  3. romulovalez commented on May 2, 2026

    @romulovalez

    @schiller-manuel This triggered this issue (open the comment): packages/vue-router/src/Matches.tsx I though it was a deliberative feature, it also created two instead of one.

    The real issue here is that we're silently skipping all styles from head on vue router, next time I will open the issue manually hahaha.

    This PR solves this issue.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions