Skip to content

inserted() hook not called when using <keep-alive> #5

@bblanchon

Description

@bblanchon

Hi,

Thank you very much for this package.

I tried to use the v-keep-scroll-position directive with Nuxt 2.15.8 / Vue 2.6.14, but it didn't work.
It correctly saves the scroll position in the attribute, but it never restores it because the inserted() hook is not called.
Since I'm using keep-alive, I'm assuming that Vue doesn't treat the component as a new one and, therefore, doesn't call inserted().

To work around this issue, I restore the scroll position from the componentUpdated() hook, and it works perfectly.
I don't know if this change can have unwanted implications, but it sure made the directive work.

Best regards,
Benoit

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