Stalled validation on update record

When updating a record and there is a value missing for an obligatory field, the loader remains in the loading state indefinitely, instead of throwing a red error validation. This is for the jurata project running the new node.js agent

Browser logs

Uncaught (in promise) Error: Attempted to handle event `becameError` on <forest-lawyers-profileText:null> while in state root.loaded.saved. 
    at en._unhandledEvent (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:370938)
    at en.send (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:369238)
    at en.adapterDidInvalidate (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:373110)
    at g._fragmentCommitWasRejected (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:534791)
    at u.commitWasRejected (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:525711)
    at g.commitWasRejected (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:532808)
    at en.adapterDidInvalidate (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:373063)
    at u.recordWasInvalid (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:391971)
    at e.pushErrors (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:629915)
    at e.validate (vendor-9133945a52f16b84d40aaad52408b6bc.js:89:617054)
_unhandledEvent @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
send @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
adapterDidInvalidate @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
_fragmentCommitWasRejected @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
commitWasRejected @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
commitWasRejected @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
adapterDidInvalidate @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
recordWasInvalid @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
pushErrors @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
validate @ vendor-9133945a52f16b84d40aaad52408b6bc.js:89
saveRecordEdition @ client-09f1bc2845f5ac0c709314f220173297.js:1
applyEditChanges @ client-09f1bc2845f5ac0c709314f220173297.js:1
E @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
triggerEvent @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
trigger @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
send @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
send @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
applyChanges @ client-09f1bc2845f5ac0c709314f220173297.js:1
onClick @ client-09f1bc2845f5ac0c709314f220173297.js:1
await in onClick (async)
E @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
triggerEvent @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
trigger @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
send @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
send @ vendor-9133945a52f16b84d40aaad52408b6bc.js:58
applyChanges @ client-09f1bc2845f5ac0c709314f220173297.js:1
onClick @ client-09f1bc2845f5ac0c709314f220173297.js:1

Hey @David_Roegiers,

Thanks for reaching out :raised_hands:
Hope you’re great!

Let me check that really quick.

Cheers.

@David_Roegiers,

I’ve just tried on my side and it seems to work fine.

So let’s deep dive into your use case.
Is your validation done like this (directly in the agent configuration):
collection.addFieldValidation('max_speed', 'Present');
?

Thank you.

Hi @adriguy

Thanks for trying it out.

The field requirement is set in the mongoose model (sorry, I could have mentioned that earlier).

profileTextSelection: { type: String, required: true, default: 'generated' },

This behaviour is new, in other words, it used to work as expected.

Hey @David_Roegiers,

Thanks for your reply!

Hum that’s strange, I’ve just tried out with the same configuration of yours, same version of agent-nodejs, no luck.
Could you please share your @forestadmin/datasource-mongoose and mongoose version please? :pray:

Are you 100% sure that the error you’re getting if due to this missing value?

Thanks.

Hi @adriguy

Sorry for the late reply, I was taking some time off.

Are you 100% sure that the error you’re getting if due to this missing value?

Yes, it only happens if I let the dropdown value of a required field empty. If I give it a valid value, it works.

Here are the versions:

    "node_modules/@forestadmin/datasource-mongoose": {
      "version": "1.5.29",
      "resolved": "https://registry.npmjs.org/@forestadmin/datasource-mongoose/-/datasource-mongoose-1.5.29.tgz",
      "integrity": "sha512-gpW0gm2LgDngeTCuoP0fp47IUMBpELjrb2ub7wG8p5/Sd19f4F079QnRPL2+58/PrkzVZz9zPK+0PGW5kN02Kw==",
      "dependencies": {
        "@forestadmin/datasource-toolkit": "1.29.0",
        "luxon": "^3.2.1"
      },
      "peerDependencies": {
        "mongoose": "6.x || 7.x"
      }
    },
...
"node_modules/mongoose": {
      "version": "6.11.5",
      "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.11.5.tgz",
      "integrity": "sha512-ZarPe1rCHG4aVb78xLuok4BBIm0HMz/Y/CjxYXCk3Qz1mEhS7bPMy6ZhSX2/Dng//R7ei8719j6K87UVM/1b3g==",
      "dependencies": {
        "bson": "^4.7.2",
        "kareem": "2.5.1",
        "mongodb": "4.16.0",
        "mpath": "0.9.0",
        "mquery": "4.0.3",
        "ms": "2.1.3",
        "sift": "16.0.1"
      },
      "engines": {
        "node": ">=12.0.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/mongoose"
      }
    },

Hi @David_Roegiers,

Thanks for your answer!
I hope your time off was great :slightly_smiling_face:

Still no luck to reproduce on my side with your exact package versions.

The field is a simple string?
How did you configured the edit widget?
And the error happens when you select the empty option of the dropdown, am I right?

Hi @adriguy

Thanks, it was :slight_smile:

Yes, the field is a string and here is the configuration.

And the error happens when you select the empty option of the dropdown, am I right?

Correct.

Hi @David_Roegiers,

Ok so same conditions than I used too so far… I’m deeply sorry, I still cannot reproduce. I’m still needing some other clues.

  • Is that field nested into an embedded field? Or is it at the root of the collection?
  • Are you using the regular edit form in details view? Or is it somewhere else that we are using it (Workspace, inline edition, etc.)?
  • No call are triggered? The frontend is crashing with an unhandled error and that’s it?

Thanks again for your help and patience.