mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29: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 topicsRef = useRef(props.topics);
|
||||
|
||||
useEffect(() => {
|
||||
document.getElementById("play-btn").disabled = true;
|
||||
|
||||
@@ -102,6 +104,10 @@ export default function Recorder(props) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
topicsRef.current = props.topics;
|
||||
}, [props.topics]);
|
||||
|
||||
useEffect(() => {
|
||||
if (record) {
|
||||
return record.on("stopRecording", () => {
|
||||
@@ -110,7 +116,7 @@ export default function Recorder(props) {
|
||||
link.download = "reflector-recording.webm";
|
||||
link.style.visibility = "visible";
|
||||
|
||||
for (let topic of props.topics) {
|
||||
for (let topic of topicsRef.current) {
|
||||
const content = document.createElement("div");
|
||||
content.style = `
|
||||
border-left: solid 1px orange;
|
||||
|
||||
Reference in New Issue
Block a user