Openvidu Browser sharing screen causes share screen prompts to pop up twice

I was using openvidu-browser version 2.22 and the share screen worked fine then. Now I’m upgrading to 2.28, but it causes my share screen prompt to pop up twice and share screen doesn’t work at all for tab share screen. Basically what I do when I click on the share screen button:

const handleShareScreen = () => {
    startWebShareScreen((stream) => {
         dispatch(setSharingScreen(true));
         dispatch(setShareScreenStream(stream));
         dispatch(setPresenterMode(true)); 
    }, dispatchMessageToast)
}

And what this startWebShareScreen is:

const startWebShareScreen = (callback, dispatchMessageToast) => {
  if (!callback) return;

  navigator.mediaDevices
    .getDisplayMedia({ audio: false })
    .then((stream) => callback(stream))
    .catch((error) => {
      dispatchMessageToast(error);
    });
};

So basically I set the stream from getDisplayMedia to a redux state and then I handle that state with a useEffect:

useEffect(() => {
    if (
        !meetingDetail ||
        !isSharingScreen ||
        !shareScreenStream ||
        !shareScreenOpenvidu ||
        !shareScreenOpenviduSession ||
        shareScreenInMeetingRoom
    ) {
        return
    }

    console.log('SS - Get token')
    dispatch(getShareScreenToken(
        meetingDetail.meetingId,
        (token) => {
            console.log("SS - Connect to openvidu session")

            console.log('SS - New publish', { shareScreenStream })
            const streamTrack = shareScreenStream.getVideoTracks()[0]
            const { width, height } = streamTrack.getSettings()

            streamTrack.contentHint = 'detail'
            streamTrack.addEventListener('ended', () => {
                dispatch(setSharingScreen(false))
                dispatch(setShareScreenStream(null))
                dispatch(setPresenterMode(false))
            })

            const connectionData = JSON.stringify({
                userOrganizationId: currentUser.userOrganizationId,
                fullName: currentUser.fullName,
                image: currentUser.avatar,
                isShareScreen: true
            })

            shareScreenOpenviduSession
                .connect(token, connectionData)
                .then(() => {
                    const newPublisher = shareScreenOpenvidu.initPublisher(undefined, {
                        resolution: `${width}x${height}`,
                        frameRate: 30,
                        insertMode: 'APPEND',
                        mirror: false,
                        videoSource: streamTrack,
                        publishAudio: false,
                        publishVideo: true,
                    });
                    shareScreenOpenviduSession.publish(newPublisher)
                    dispatch(setShareScreenPublisher(newPublisher))
                    dispatch(setShareScreenInMeetingRoom(true))
                })
        }
    ))
}, [
    isSharingScreen,
    shareScreenStream,
    shareScreenInMeetingRoom,
    shareScreenOpenvidu,
    shareScreenOpenviduSession
])

But this somehow, causes the prompt to pop up again after selecting a screen I want to share. The second time I choose, then it will work. And that’s the thing, it works, but only on the second time. But note that it doesn’t work for tab sharing. What am I missing here?