diff --git a/resources/js/components/ui/Publish/Container.vue b/resources/js/components/ui/Publish/Container.vue index 98698554cf6..65a6785d899 100644 --- a/resources/js/components/ui/Publish/Container.vue +++ b/resources/js/components/ui/Publish/Container.vue @@ -260,12 +260,12 @@ const fieldLocks = computed(() => { function focusField(handle, user = Statamic.user) { if (handle.includes('.')) throw new Error('focusField only supports top-level fields.'); - fieldFocus.value[user.id] = { handle, user }; + if (user) fieldFocus.value[user.id] = { handle, user }; } function blurField(handle, user = Statamic.user) { if (handle.includes('.')) throw new Error('blurField only supports top-level fields.'); - if (fieldFocus.value[user.id]?.handle === handle) { + if (user && fieldFocus.value[user.id]?.handle === handle) { delete fieldFocus.value[user.id]; } } diff --git a/src/Fields/Blueprint.php b/src/Fields/Blueprint.php index 33619eb35f3..2503a80c277 100644 --- a/src/Fields/Blueprint.php +++ b/src/Fields/Blueprint.php @@ -457,7 +457,7 @@ public function toPublishArray() 'fqh' => $this->fullyQualifiedHandle(), 'token' => encrypt([ 'fqh' => $this->fullyQualifiedHandle(), - 'user_id' => User::current()->id(), + 'user_id' => User::current()?->id(), ]), ]; }