Skip to content

Adding condition to User fields can break creating new users #15316

Description

@hairylemon-developers

Bug description

On the User blueprint I added a field with Condition "Show when 'roles' contains 'user'".

Now when creating a new user, the roles doesn't exist and Vue throws an error since it can't handle the condition and breaks the new user wizard (clicking Next doesn't change the screen) and warning + error below are shown in console.

How to reproduce

Add a condition based on default "roles" field, try to create a new user.

Logs

vue.esm-bundler-FaDyk5AC.js:1726 [Vue warn]: Unhandled error during execution of component update 
  at <Wizard route="https://floornz-portal.test/cp/users" users-index-url="https://floornz-portal.test/cp/users" users-create-url="https://floornz-portal.test/cp/users/create"  ... > 
  at <Create errors= {} _statamic= {cmsName: 'Statamic', logos: {…}, isCpRoute: true, version: '6.30.0', isPro: true, …} values= {account_status: 'pending', first_name: null, last_name: null, email: null, start_date: null, …}  ... > 
  at <ConfigProvider> 
  at <Layout errors= {} _statamic= {cmsName: 'Statamic', logos: {…}, isCpRoute: true, version: '6.30.0', isPro: true, …} values= {account_status: 'pending', first_name: null, last_name: null, email: null, start_date: null, …}  ... > 
  at <Inertia initialPage= {component: 'users/Create', props: {…}, url: '/cp/users/create', version: '3aaa192d60e975e5d758665b6aa6cb80', sharedProps: Array(2)} initialComponent= {__name: 'Create', props: Array(13), __file: 'Create.vue', setup: ƒ, render: ƒ, …} resolveComponent=fn<resolveComponent>  ... > 
  at <App>
warn$1 @ vue.esm-bundler-FaDyk5AC.js:1726
logError @ vue.esm-bundler-FaDyk5AC.js:1913
handleError @ vue.esm-bundler-FaDyk5AC.js:1907
callWithErrorHandling @ vue.esm-bundler-FaDyk5AC.js:1865
flushJobs @ vue.esm-bundler-FaDyk5AC.js:2012
Promise.then
queueFlush @ vue.esm-bundler-FaDyk5AC.js:1954
queueJob @ vue.esm-bundler-FaDyk5AC.js:1950
effect.scheduler @ vue.esm-bundler-FaDyk5AC.js:5587
trigger @ vue.esm-bundler-FaDyk5AC.js:419
endBatch @ vue.esm-bundler-FaDyk5AC.js:469
trigger @ vue.esm-bundler-FaDyk5AC.js:774
set @ vue.esm-bundler-FaDyk5AC.js:1021
set @ vue.esm-bundler-FaDyk5AC.js:3984
goToStep @ index-CCk14Dcr.js:23762
next @ index-CCk14Dcr.js:23765
Promise.then
nextStep @ index-CCk14Dcr.js:23872
callWithErrorHandling @ vue.esm-bundler-FaDyk5AC.js:1863
callWithAsyncErrorHandling @ vue.esm-bundler-FaDyk5AC.js:1870
invoker @ vue.esm-bundler-FaDyk5AC.js:7874


vue.esm-bundler-FaDyk5AC.js:5774 Uncaught (in promise) TypeError: Cannot destructure property 'type' of 'vnode' as it is null.
    at unmount (vue.esm-bundler-FaDyk5AC.js:5774:11)
    at unmountComponent (vue.esm-bundler-FaDyk5AC.js:5852:4)
    at unmount (vue.esm-bundler-FaDyk5AC.js:5790:22)
    at unmountChildren (vue.esm-bundler-FaDyk5AC.js:5861:49)
    at unmount (vue.esm-bundler-FaDyk5AC.js:5798:116)
    at unmountComponent (vue.esm-bundler-FaDyk5AC.js:5852:4)
    at unmount (vue.esm-bundler-FaDyk5AC.js:5790:22)
    at unmountChildren (vue.esm-bundler-FaDyk5AC.js:5861:49)
    at unmount (vue.esm-bundler-FaDyk5AC.js:5799:83)
    at unmountChildren (vue.esm-bundler-FaDyk5AC.js:5861:49)

Environment

Environment
Laravel Version: 13.29.0
PHP Version: 8.4.22
Composer Version: 2.10.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
public/storage: LINKED

Statamic
Addons: 0
License Key: Not set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.30.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

Using DDEV

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions