Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in swiper_angular.js in version 7.3.1 or 7.3.2 #5291

Closed
5 of 6 tasks
julgon2012 opened this issue Dec 13, 2021 · 5 comments · Fixed by #5296
Closed
5 of 6 tasks

Error in swiper_angular.js in version 7.3.1 or 7.3.2 #5291

julgon2012 opened this issue Dec 13, 2021 · 5 comments · Fixed by #5296

Comments

@julgon2012
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

no reproduction link

Bug description

An error occurs at line 729 (version 7.3.0) when you try to run

if (changedParams.scrollbar) {
if (this.scrollbar &&
typeof this.scrollbar !== 'boolean' &&
this.scrollbar.el &&
scrollbar &&
!scrollbar.el) {
this.updateParameter('scrollbar', this.scrollbar);
scrollbar.init();
scrollbar.updateSize();
scrollbar.setTranslate();
}
else {
scrollbar.destroy(); // --------> here!
scrollbar.el = null;
}
}

because the scrollbar object is undefined, but changedParams.scrollbar is true.

This does not happen until version 7.3.0 .-

In my project there are 3 swipers, but none use scrollbar, I don't even read the Scrollbar object from swiper.

Expected Behavior

No response

Actual Behavior

No response

Swiper version

7.3.1 or 7.3.2

Platform/Target and Browser Versions

Windows 10 Pro, Chrome Versión 96.0.4664.93 (Build oficial) (64 bits)

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
@github-actions
Copy link

Hello @julgon2012. Please provide a online reproduction by codesandbox or a minimal GitHub repository. You can fork one of our demos in codesandbox to get start. Issues labeled by missing demo will be closed if no activities in 3 days.

@orjandh
Copy link

orjandh commented Dec 14, 2021

Can confirm this problem was introduced in version 7.3.2.

Additional errors in:

Cannot read properties of undefined (reading 'destroy')
at swiper_angular.js:721

Cannot read properties of undefined (reading 'prevEl')
at swiper_angular.js:753

Cannot read properties of undefined (reading 'destroy')
at swiper_angular.js:721

@orjandh
Copy link

orjandh commented Dec 15, 2021

I think I have managed to isolate the issue to slides that are being populated after initialization.

import { Component } from '@angular/core';

@Component({
    selector: 'app-card-strip',
    templateUrl: 'card-strip.html',
    styleUrls: ['./card-strip.scss']
})
export class CardStripComponent {

    slides;

    constructor() {
        setTimeout(() => {
            this.slides = [1, 2];
        },0);
    }
}

.

<swiper>
    <ng-template swiperSlide *ngFor="let slide of slides;" >
        slide {{slide}}
    </ng-template>
</swiper>

In my environment, this gives these exact errors in 7.3.2, but not 7.3.1.

@mihpa
Copy link

mihpa commented Dec 16, 2021

Same issue in our project with 7.3.2 version. Temporary fixed by return on 7.3.0.

Can confirm this problem was introduced in version 7.3.2.

Additional errors in:

Cannot read properties of undefined (reading 'destroy') at swiper_angular.js:721

Cannot read properties of undefined (reading 'prevEl') at swiper_angular.js:753

Cannot read properties of undefined (reading 'destroy') at swiper_angular.js:721

@vltansky
Copy link
Collaborator

vltansky commented Dec 16, 2021

Thanks for reporting!
7.3.3 released with a fix

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

Successfully merging a pull request may close this issue.

5 participants