mirror of
https://github.com/Qortal/q-tube.git
synced 2025-02-15 19:55:52 +00:00
fix id issue
This commit is contained in:
parent
43dc2856ae
commit
683699dffb
@ -37,7 +37,7 @@ export const useFetchVideos = () => {
|
|||||||
|
|
||||||
const checkAndUpdateVideo = React.useCallback(
|
const checkAndUpdateVideo = React.useCallback(
|
||||||
(video: Video) => {
|
(video: Video) => {
|
||||||
const existingVideo = hashMapVideos[video.id];
|
const existingVideo = hashMapVideos[video.id + "-" + video.user];
|
||||||
if (!existingVideo) {
|
if (!existingVideo) {
|
||||||
return true;
|
return true;
|
||||||
} else if (
|
} else if (
|
||||||
|
@ -539,7 +539,8 @@ export const VideoList = ({ mode }: VideoListProps) => {
|
|||||||
|
|
||||||
<VideoCardContainer>
|
<VideoCardContainer>
|
||||||
{videos.map((video: any, index: number) => {
|
{videos.map((video: any, index: number) => {
|
||||||
const existingVideo = hashMapVideos[video?.id];
|
const fullId = video ? `${video.id}-${video.user}` : undefined;
|
||||||
|
const existingVideo = hashMapVideos[fullId];
|
||||||
let hasHash = false;
|
let hasHash = false;
|
||||||
let videoObj = video;
|
let videoObj = video;
|
||||||
if (existingVideo) {
|
if (existingVideo) {
|
||||||
|
@ -133,7 +133,7 @@ export const VideoListComponentLevel = ({ mode }: VideoListProps) => {
|
|||||||
>
|
>
|
||||||
<VideoCardContainer>
|
<VideoCardContainer>
|
||||||
{videos.map((video: any, index: number) => {
|
{videos.map((video: any, index: number) => {
|
||||||
const existingVideo = hashMapVideos[video.id];
|
const existingVideo = hashMapVideos[video.id + '-' + video.user];
|
||||||
let hasHash = false;
|
let hasHash = false;
|
||||||
let videoObj = video;
|
let videoObj = video;
|
||||||
if (existingVideo) {
|
if (existingVideo) {
|
||||||
|
@ -261,7 +261,7 @@ export const PlaylistContent = () => {
|
|||||||
setPlaylistData(combinedData);
|
setPlaylistData(combinedData);
|
||||||
if (combinedData?.videos?.length > 0) {
|
if (combinedData?.videos?.length > 0) {
|
||||||
const vid = combinedData?.videos[0];
|
const vid = combinedData?.videos[0];
|
||||||
const existingVideo = hashMapVideos[vid?.identifier];
|
const existingVideo = hashMapVideos[vid?.identifier + '-' + vid.name];
|
||||||
|
|
||||||
if (existingVideo) {
|
if (existingVideo) {
|
||||||
setVideoData(existingVideo);
|
setVideoData(existingVideo);
|
||||||
|
@ -280,7 +280,7 @@ export const VideoContent = () => {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (name && id) {
|
if (name && id) {
|
||||||
const existingVideo = hashMapVideos[id];
|
const existingVideo = hashMapVideos[id + '-' + name];
|
||||||
|
|
||||||
if (existingVideo) {
|
if (existingVideo) {
|
||||||
setVideoData(existingVideo);
|
setVideoData(existingVideo);
|
||||||
|
@ -113,16 +113,16 @@ export const videoSlice = createSlice({
|
|||||||
},
|
},
|
||||||
addToHashMap: (state, action) => {
|
addToHashMap: (state, action) => {
|
||||||
const video = action.payload
|
const video = action.payload
|
||||||
state.hashMapVideos[video.id] = video
|
const fullId state.hashMapVideos[video.id + '-' + video.user] = video
|
||||||
},
|
},
|
||||||
addtoHashMapSuperlikes: (state, action) => {
|
addtoHashMapSuperlikes: (state, action) => {
|
||||||
const superlike = action.payload
|
const superlike = action.payload
|
||||||
state.hashMapSuperlikes[superlike.identifier] = superlike
|
state.hashMapSuperlikes[superlike.identifier] = superlike
|
||||||
},
|
},
|
||||||
updateInHashMap: (state, action) => {
|
updateInHashMap: (state, action) => {
|
||||||
const { id } = action.payload
|
const { id, user } = action.payload
|
||||||
const video = action.payload
|
const video = action.payload
|
||||||
state.hashMapVideos[id] = { ...video }
|
state.hashMapVideos[id + '-' + user] = { ...video }
|
||||||
},
|
},
|
||||||
removeFromHashMap: (state, action) => {
|
removeFromHashMap: (state, action) => {
|
||||||
const idToDelete = action.payload
|
const idToDelete = action.payload
|
||||||
@ -131,7 +131,7 @@ export const videoSlice = createSlice({
|
|||||||
addArrayToHashMap: (state, action) => {
|
addArrayToHashMap: (state, action) => {
|
||||||
const videos = action.payload
|
const videos = action.payload
|
||||||
videos.forEach((video: Video) => {
|
videos.forEach((video: Video) => {
|
||||||
state.hashMapVideos[video.id] = video
|
state.hashMapVideos[video.id + '-' + video.user] = video
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
upsertVideos: (state, action) => {
|
upsertVideos: (state, action) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user