Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Safeguard for setFocus since the referenced element might have already gone

天舟a9d2ef2908ca
diff --git a/frontend/src/bbkit/BBTextField.vue b/frontend/src/bbkit/BBTextField.vue
index 4477f469f6..54c55c2427 100644
--- a/frontend/src/bbkit/BBTextField.vue
+++ b/frontend/src/bbkit/BBTextField.vue
@@ -90,11 +90,13 @@ export default {
state.hasError = true;
nextTick(() => {
state.text = state.originalText;
- // Since we set focus in the nextTick, inputField might already disappear due to outside state change.
- inputField.value.focus();
- nextTick(() => {
- inputField.value.select();
- });
+ if (inputField.value) {
+ // Since we set focus in the nextTick, inputField might already disappear due to outside state change.
+ inputField.value.focus();
+ nextTick(() => {
+ inputField.value.select();
+ });
+ }
});
} else {
state.hasError = false;