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

Fix Race Condition if goToSlide is called too early #2295

Merged

Conversation

patrick-mcdougle
Copy link
Contributor

@patrick-mcdougle patrick-mcdougle commented Dec 2, 2024

If you try to call goToSlide after construction, but before the first render, this.scrollContainer can be null and you get a console error. This prevents the console error.

Screenshot 2024-12-02 at 2 57 34 PM

Fixes #2296

Copy link

vercel bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ✅ Ready (Inspect) Visit Preview Dec 2, 2024 9:00pm

@claviska
Copy link
Member

claviska commented Dec 4, 2024

Thank you for this (and your other) PR!

@claviska claviska merged commit 5d0c877 into shoelace-style:next Dec 4, 2024
1 of 2 checks passed
@patrick-mcdougle patrick-mcdougle deleted the carousel-null-scrollContainer branch December 4, 2024 20:16
@patrick-mcdougle
Copy link
Contributor Author

@claviska Thanks for being willing to let me contribute! Let me know if it was me who broke the tests and I can try to fix that...also thanks for dealing with the merge conflict and the fact that I didn't run prettier! Community!

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

Successfully merging this pull request may close these issues.

Calling goToSlide before first render generates a console error
2 participants