Closed daviddunnington closed 1 year ago
Hey @daviddunnington , thank you for submitting a detailed issue. I used your sample code to create a codesandbox and I could not reproduce the issue. Can you check if there's something missing here? https://codesandbox.io/s/eager-thunder-wzksmk
Hey @mohitk05
Thanks for such a fast reply, I have had a look at your code sandbox and it's working perfectly and set up exactly the same as I had set it up. The only difference is I'm using Next.js in my project I'm still new to next so could be something I have set up wrong.
I have created a sandbox with a Next.Js project and you can see it has the error. If you could have a look and see if you can notice anything that would be great in the meantime I will do some digging and make sure I'm using Next.js correctly.
https://codesandbox.io/p/sandbox/thirsty-mccarthy-tfhjwk
Thanks again for your help.
@mohitk05 I was able to resolve the problem by not lazy loading the react-insta-stories component on initial page load as this is handled slightly different in Next.js
import dynamic from 'next/dynamic'
const StoriesLazy = dynamic(() => import('react-insta-stories'))
Please let me know if you have any other questions! I appreciate you taking the time to reply to this bug.
Ah, glad you were able to resolve it. Yes, I think the behaviour is a bit different on SSR, will check if I get some time.
@mohitk05 I was able to resolve the problem by not lazy loading the react-insta-stories component on initial page load as this is handled slightly different in Next.js
import dynamic from 'next/dynamic' const StoriesLazy = dynamic(() => import('react-insta-stories'))
Please let me know if you have any other questions! I appreciate you taking the time to reply to this bug.
Issue still exists even if we use dynamic
import.
Sandbox still doesn't load on the initial load.
https://codesandbox.io/p/devbox/thirsty-mccarthy-tfhjwk?file=%2Fcomponents%2Finsta.js%3A10%2C19
Okay, was able to fix it by spotting this code snippet in another issue:
import dynamic from 'next/dynamic';
const StoriesLazy = dynamic(() => import('react-insta-stories'), {
ssr: false,
});
Issue Description: When using the
react-insta-stories
component, if the first story in thestories
array is an image or video, only the loading spinner is visible initially, and the actual image or video doesn't appear until navigating to the next story and then going back. This issue occurs even if the image or video is already loaded in the background. The problem can be reproduced by rearranging the order of the stories array, where the first item is an image or video.https://github.com/mohitk05/react-insta-stories/assets/19631764/6ec21672-1b1a-4330-8766-f5dfe75a2e97
Steps to Reproduce:
react-insta-stories
component with an array of stories.Expected Behavior: The first story, whether it's an image or video, should be displayed immediately without only the loading spinner visible.
Actual Behavior: Only the loading spinner is visible for the first story, and the actual image or video is not displayed until navigating to the next story and going back.
Example Working Array:
Example Not Working Array:
Sample Code:
Additional Information:
Version of react-insta-stories library: 2.6.1 Environment: (NEXT.js 13.4.7) Browses Tested: (Google Chrome, Safari)