Can I trigger validation hooks on URL changes?

What are you trying to accomplish
I’m trying to set up a validation hook so page URLs can’t have spaces in them.

I was able to get my validation hook to consider the URL by working off the solution in “ Validation hook to validate Page url ”, the app only triggers validation when another field is edited. As long as someone doesn’t edit any other fields, they can enter an invalid URL and publish the change.

If someone edits another field after changing the URL to something invalid, it does trigger the validation and prevent submission. (Though, in the opposite side of the issue, if I make the URL invalid, edit another field, then make the URL valid, the validation error state doesn’t clear until I’ve edited something else again.)

I wanted to check that this isn’t a misconfiguration case on my end or if there is a way to trigger validation on URL entry.

Screenshots or video link
url-validation-hook

Code stack you are integrating Builder with
Next.JS

Code example
Here is my current validation hook for the model. It’s still got some of the sample code in it, but I included that just in case that’s causing any of my problem.

/*
* check this doc for more info on available objects and return types https://www.builder.io/c/docs/validation-hooks
* Use level 'error' to block publishing or level 'warning' to display a message without blocking publishing
*/

 async function run() {
   const urlPath = contentModel.query.find(q => q.property === 'urlPath')?.toJSON().value;
   const allUrls = Array.isArray(urlPath) ? urlPath : [urlPath];
   if (allUrls.some((url) => /\s/.test(url))) {
    return {
      level: 'error',
      message: 'URLs may not have spaces'
    }
   }

   if (contentModel.data.get('myProperty') === 'some invalid value') {
     return {
       level: 'error',
       message: 'myProperty is invalid!'
     }
   }
 }
 return run();