Hi there,
I have been working on a site been using more of the mandatory fields and I have noticed that the block lists in 17.6.0 seems to not clear the failed validation even when its filled out like the rest of the fields? Just wondering if this is intended and I’m being silly or if this is potentially a issue? In order to get the block list to change its validation status we need to save the work we have done and then refresh to clear the validation status.
Hi @WesleyAtkinson23
It sounds like the same issue report here:
opened 01:21PM - 09 Sep 26 UTC
state/needs-investigation
state/sprint-candidate
type/bug
state/reproduced
area/frontend
affected/v17
category/regression
### Which Umbraco version are you using?
17.6.2
### Bug summary
On a new docu… ment, if the first "Save and publish" fails validation, every later "Save and publish" fails too - with the same "Document could not be published, but we saved it for you" toast - even after the invalid field has been fixed and everything is valid. The document stays unpublished until the page is refreshed; after F5 the same values publish fine.
Reproduced with a mandatory Block List (block element type with a mandatory Textstring) on a document type that varies by culture, left empty on the first publish. Reproduced on our site (Umbraco Cloud) and on a clean `dotnet new umbraco` 17.6.2 install with no packages and no custom code. 100% reproducible.
**Impact:** editors cannot publish a document whose first publish failed until they refresh the page.
**Workaround:** refresh the page, then publish.
### Version tested
Reproduced on **17.6.2** (latest 17.x). **Not tested on 18.x.**
### Related issues
- #17428 / PR #17976
- #16561
- #23042
- #22364
### Specifics
**Environment**
- Umbraco.Cms 17.6.2, .NET 10, backoffice (Bellissima)
- SQLite locally; same on Umbraco Cloud
- Chromium 152; also Chrome and Edge on Windows
- Reproduced on a clean `dotnet new umbraco` install with no packages and no custom code
**Observations**
- The toast is the same on the first (legitimate) failure and on every later attempt: "Document could not be published, but we saved it for you."
- After the failed first publish the workspace switches from "new" to "existing" in place (`/create/...` -> `/edit/{id}`) without a reload.
- On every later publish a `client` `#validation_invalidEmpty` message for the Block List is present in the validation context, while the Block List control itself reports valid.
- Resetting the document workspace's validation context when `isNew` flips true -> false (via a `workspaceContext` extension) makes the publish go through.
**Ruled out**
Custom property editors, packages, site configuration, culture/`expose` mismatch (#22364), server-side handlers.
### Steps to reproduce
Clean install: `dotnet new umbraco` with Umbraco.Templates 17.6.2, SQLite, no packages, no custom code.
**Setup**
1. Add a second language.
2. Create an Element Type with one Textstring property, Mandatory on.
3. Create a Block List Data Type with that Element Type as its only block, no min/max.
4. Create a Document Type: Allow at root, Vary by culture, with one Block List property using that Data Type, Mandatory on, Vary by culture on.
**Repro**
1. Create a new document of that type, enter a name, leave the Block List empty.
2. **Save and publish** -> confirm.
Toast "Document could not be published, but we saved it for you" (expected). Draft is created, URL switches from `/create/...` to `/edit/{id}`.
3. Add a block, fill its Textstring. Everything is now valid; the field shows no error.
4. **Save and publish** -> confirm.
**Same toast. Document stays unpublished.** Retrying does nothing.
5. Press F5, then **Save and publish** with the same values -> publishes.
### Expected result / actual result
### Expected
Step 4 publishes the document (`PUT /umbraco/management/api/v1/document/{id}/update-and-publish`), exactly as it does after a refresh in step 5.
### Actual
Step 4 shows the toast "Document could not be published, but we saved it for you" and the document stays unpublished.
Network at step 4:
```
PUT /umbraco/management/api/v1.1/document/{id}/validate -> 200
PUT /umbraco/management/api/v1/document/{id} -> 200 (plain save)
no /update-and-publish
```
After F5 (step 5):
```
PUT /umbraco/management/api/v1/document/{id}/update-and-publish -> 200
```
Database: `umbracoDocument.published = 0` after step 4, `= 1` after step 5.
Console at step 4 (`packages/content/content/index.js`, `_validateVariantsAndLog`):
```
Validation failed because of these validation messages still begin present:
[{
type: "client",
path: "$.values[?(@.alias == '<blockListAlias>' && @.culture == 'en-US' && @.segment == null)].value",
body: "#validation_invalidEmpty"
}]
```
At that moment the `umb-property-editor-ui-block-list` element is valid: 1 item, `checkValidity()` returns `true`, empty `validationMessage`.
---
_This item has been added to our backlog AB#71463_
They are looking into it but it has no release data yet.
Justin