Skip to content

Angular excessive change detection triggered using Swiper Element with Parameters As Props #8049

@francisIII

Description

@francisIII

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/devbox/yp7x4z

Bug description

Using Swiper Element in Angular with Parameters As Props (see here) triggers Angular's change detection excessively. It is being triggered on every single mouse move, even when not near or interacting with swiper.

Open the reproduction demo and inspect in the console to see 'change detection' being triggered on every mouse move. It gets up to the 1000s very quickly.

Image

The other swiper with Parameters as Attributes, does not trigger change detection in this way.

Is there a better way to initialize Swiper with Parameters as Props in Angular?

Expected Behavior

Change detection should not be triggered excessively when using swiper with Parameters as Props in Angular.

Actual Behavior

Swiper with Parameters as Props and initialized in Angular lifecycle method triggers Angular's change detection on basically every mouse move. This is bad for performance.

Swiper version

11.2.10

Platform/Target and Browser Versions

macOS Chrome 138.0.7204.102

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR

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