Skip to content

Some one understand what he do? #3795

@n4an

Description

@n4an

What shit is this? I call it in nuxt component in pages dir and SSR mode.

[No active route record was found when calling onBeforeRouteLeave()](vue-router.mjs:35 [Vue Router warn]: No active route record was found when calling onBeforeRouteLeave()`. Make sure you call this function inside a component child of . Maybe you called it inside of App.vue?)

const activeRecord = inject(matchedRouteKey, 
    // to avoid warning
    {}).value;
    if (!activeRecord) {
        (process.env.NODE_ENV !== 'production') &&
            warn('No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?');
        return;
    }
    registerGuard(activeRecord, 'leaveGuards', leaveGuard);

That cause problem?

[Vue warn]: inject() can only be used inside setup() or functional components.
[log error] TypeError: Cannot read properties of undefined (reading 'modules')

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