Skip to content

Commit 43c081c

Browse files
authored
fix for set_focus not binding this (#5183)
1 parent 48b405a commit 43c081c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

reflex/.templates/web/utils/state.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ export const applyEvent = async (event, socket) => {
243243
if (event.name == "_set_focus") {
244244
const ref =
245245
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
246-
const focus = ref?.current?.focus;
247-
if (focus === undefined) {
246+
const current = ref?.current;
247+
if (current === undefined || current?.focus === undefined) {
248248
console.error(
249249
`No element found for ref ${event.payload.ref} in _set_focus`,
250250
);
251251
} else {
252-
focus();
252+
current.focus();
253253
}
254254
return false;
255255
}

0 commit comments

Comments
 (0)