Swiper component Initial Rendering Issue: Incorrect Alignment on First Load #7490
Closed
druvkotwani
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Description: The Swiper component does not render correctly on the first load or after navigating from another page, leading to incorrect alignment of elements.
Expected Behavior: The Swiper component should display correctly with all elements properly aligned on the first load.
Actual Behavior: Elements within the Swiper component are not correctly aligned until a hard refresh is performed.
Steps to Reproduce:
Navigate to the page containing the Swiper component. Don't load that page directly.
Notice the incorrect alignment of elements.
Perform a hard refresh to see the correct alignment.
Environment:
Browser: Chrome / Brave
Operating System: Windows 11
Libraries/Frameworks: NextJs ^13.4.4, React ^18.2.0, Swiper ^8.4.5
Workarounds Attempted:
Setting the initialSlide prop to an index of the slide in the middle.
Adjusting the centeredSlides prop to true.
Screenshots or Code Snippets:
![Screenshot 2024-04-23 225403](https://private-user-images.githubusercontent.com/96691139/325035223-ac33f35a-87a8-47f8-8d40-4abf23e5149f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNzg2NjEsIm5iZiI6MTczOTI3ODM2MSwicGF0aCI6Ii85NjY5MTEzOS8zMjUwMzUyMjMtYWMzM2YzNWEtODdhOC00N2Y4LThkNDAtNGFiZjIzZTUxNDlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDEyNTI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkZWYxMGZiYjBjNGZlYmRmNGUwYjYwNmI1NjU5YTE4ODc3MWQxYzE0ZGIxNWVjMTAxMmE1YTBhYzgyYzZkY2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.IAE-nClfMemkYUOFKBLuW987NcIRrl5dd3uLu45wbpk)
![Screenshot 2024-04-23 225422](https://private-user-images.githubusercontent.com/96691139/325035233-6fc0a48a-f104-44bb-ba83-1834840e4948.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNzg2NjEsIm5iZiI6MTczOTI3ODM2MSwicGF0aCI6Ii85NjY5MTEzOS8zMjUwMzUyMzMtNmZjMGE0OGEtZjEwNC00NGJiLWJhODMtMTgzNDg0MGU0OTQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDEyNTI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1NTEzOTIyN2Y0ZGRkMTA1YjBlMjQwZTIxYjIwZGRjZDQ4NWUxNDI0YzIzNjNkYWVhODQxYWEwMDBkMzVlOGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.bVuTup6SmqDzyrB2zBGLIDZ-UTLqUeWY9lMHTvnw_-I)
![Screenshot 2024-04-23 225446](https://private-user-images.githubusercontent.com/96691139/325035655-b4a8fc03-4e28-4438-9847-a0eb56834eb4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNzg2NjEsIm5iZiI6MTczOTI3ODM2MSwicGF0aCI6Ii85NjY5MTEzOS8zMjUwMzU2NTUtYjRhOGZjMDMtNGUyOC00NDM4LTk4NDctYTBlYjU2ODM0ZWI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDEyNTI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE4YzBmNTI5OTNiMjQ0MWNlYWE2ZDdhNzFhZjViZmFlNmIzODRhYjI1OGRiZDJjOTc0NzI5MGNhMDNjODBiMDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PqNCgHF5EiuSVlEE6bus-LGSESJkjYXsoof0l9vqhU0)
Additional Context:
The Swiper component is configured with slidesPerView={1} and pagination={{ clickable: true }}.
Beta Was this translation helpful? Give feedback.
All reactions