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

(Bug) videoUrl does not get updated on props change #6

Open
srivastava9 opened this issue Nov 2, 2020 · 3 comments
Open

(Bug) videoUrl does not get updated on props change #6

srivastava9 opened this issue Nov 2, 2020 · 3 comments

Comments

@srivastava9
Copy link

srivastava9 commented Nov 2, 2020

While using VideoThumbnail and changing the videoUrl of using props does not changes videoUrl and same thumbnail gets generated again

@srivastava9 srivastava9 changed the title (Bug) While using VideoThumbnail and changing the videoUrl of using props does not changes videoUrl and same thumbnail gets generated again (Bug) videoUrl does not get updated on props change Nov 2, 2020
@srivastava9
Copy link
Author

@brothatru Could you please look into this and tell me a turnaround as this library is very important for my project

@umer-qureshi
Copy link

umer-qureshi commented Nov 30, 2020

Did you find a solution for this?

@umer-qureshi
Copy link

umer-qureshi commented Nov 30, 2020

Since this bug was making an issue, how i approached this was to use a timer to hide it for 100ms and so that it is forced to rerender. i ll post the code for it below.

const [
      forceRerender,
      setForceRerender,
  ] =useState(ZERO)
  useEffect(() => {
      if (src) {
          setForceRerender(ZERO)
     
      const timer = setTimeout(() => {
          setForceRerender(forceRerender+ ONE)
      }, HUNDRED)
      return () => clearTimeout(timer)
}
  }, [
      src,
  ])
return (
{ forceRerender > ZERO &&<VideoThumbnail
                          videoUrl={src}
                      />}
)

Where the src is the url incoming from the props.
This worked out for me. Good luck!
P.S in case the logic can be improved, please do let me know!

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

No branches or pull requests

2 participants