mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
fix stale props
This commit is contained in:
@@ -63,6 +63,8 @@ export default function Recorder(props) {
|
|||||||
|
|
||||||
const [activeTopic, setActiveTopic] = props.useActiveTopic;
|
const [activeTopic, setActiveTopic] = props.useActiveTopic;
|
||||||
|
|
||||||
|
const topicsRef = useRef(props.topics);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.getElementById("play-btn").disabled = true;
|
document.getElementById("play-btn").disabled = true;
|
||||||
|
|
||||||
@@ -102,6 +104,10 @@ export default function Recorder(props) {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
topicsRef.current = props.topics;
|
||||||
|
}, [props.topics]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (record) {
|
if (record) {
|
||||||
return record.on("stopRecording", () => {
|
return record.on("stopRecording", () => {
|
||||||
@@ -110,7 +116,7 @@ export default function Recorder(props) {
|
|||||||
link.download = "reflector-recording.webm";
|
link.download = "reflector-recording.webm";
|
||||||
link.style.visibility = "visible";
|
link.style.visibility = "visible";
|
||||||
|
|
||||||
for (let topic of props.topics) {
|
for (let topic of topicsRef.current) {
|
||||||
const content = document.createElement("div");
|
const content = document.createElement("div");
|
||||||
content.style = `
|
content.style = `
|
||||||
border-left: solid 1px orange;
|
border-left: solid 1px orange;
|
||||||
|
|||||||
Reference in New Issue
Block a user