Skip to content

Commit 2d0c4d6

Browse files
committed
fix: fix youtube link not showing
1 parent c60a7ae commit 2d0c4d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { makeStyles } from '@mui/styles';
33
import { ClearRounded, CloudUploadOutlined } from '@mui/icons-material';
44
import clsx from 'clsx';
55
import _ from 'lodash';
6-
import React, { useRef } from 'react';
6+
import React, { useRef, useEffect } from 'react';
77
import styles from '../../../assets/js/styles';
88
import { isGdriveORVimeoORYoutube } from '../../../views/project_details/projectDetailsScripts';
99
import { refactorVideoUrl } from '../../input/inputScripts';
@@ -15,7 +15,7 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue
1515
const classes = makeStyles(videoInputStyles)();
1616
const input = useRef(null);
1717
const videoRef = useRef(null);
18-
const clickCount = 0;
18+
var clickCount = 0;
1919

2020
const handleFileChange = files => {
2121
const maxAssets = 1;
@@ -76,6 +76,12 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue
7676
handleChange('', 'link');
7777
};
7878

79+
useEffect(() => {
80+
if (linkValue) {
81+
handleChange(linkValue, 'link');
82+
}
83+
}, [linkValue, handleChange]);
84+
7985
const uploadedVideo = () => {
8086
if (typeof value !== 'string' && value?.length > 0) {
8187
return value?.map((asset, index) => (

0 commit comments

Comments
 (0)