[SOLVED] Querying squidex content with SquidexClient Library returns wrong item status

I have…

  • [ ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [x] Performance issue
  • [ ] Documentation issue or request

Current behavior

So a content item is Published + Draft in squidex.
From Inspect tab, and by squdiex api - status displayed as:

status: Published, newStatus: Draft

And in DB, CoreCMSContent it’s displayed as

States_Contents_All3
“ss”:“Published”,“ns”:“Draft”

States_Contents_Published3
ss: ‘Published’

But when queried by squidexClient

var queryResult = await authorsSquidexClient.GetAsync(new ContentQuery
{
Filter = $“data/ArticleId/iv eq ‘{draftAuthor.ArticleId}’”
},
QueryContext.Default.Unpublished(true));

The result is :

Status: Draft, NewStatus: Draft

So I spotted, that querying for all content in Squidex, that has status Published-Draft or Published-Unpublished - squidex client by GetAsync() returns wrong Status property.

Expected behavior

SquidexClient returns Status: “Published” for this items, as in other places.

Minimal reproduction of the problem

1 Simply populate some content in squidex.
2 Make it Published - Draft and Published - Unpublished
3 Query it with by the next principal

var queryResult = await authorsSquidexClient.GetAsync(new ContentQuery
{
Filter = $“data/ArticleId/iv eq ‘{draftAuthor.ArticleId}’”
},
QueryContext.Default.Unpublished(true));

Explore queryResult statuses as duplicated:

  • queryResult.Status = Draft, queryResult.NewStatus = Draft (for Published - Draft item)
  • queryResult.Status = Unpublished, queryResult.NewStatus = Unpublished (for Published - Unpublished item)

Environment

  • [X] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Squidex Version: 7.2
SquidexClientLIbrary 10.2.0

Not sure how this happened. If it cannot be reproduced, I am just ignoring it for now.

Hello Sebastian
I continued to work with that, and I spotted it as global issue.
I’ve added reproduction steps, and edited a bit the report - added description and cases.

Thanks. I will have a look.

What do you mean with “Unpublished”. Is this a custom workflow status?

Huh, sorry. Not aware of default flow…
Probably yes, it’s custom.
Not sure does exactly mean Published - Unpublished. :sweat_smile:
It’s green + red in ‘Status’ column

Is it principal? Will try to figure out more

I still have no idea how to reproduce it. Your instructions are not clear to me.

We can focus on Published - Draft status. It should be a default squidex flow?
We had a Published item, and we created a new draft. So status become Published - Draft (green and grey circles both).

The issue is simple.
When you query such item from squidex using SquidexClientLibrary using base method GetAsync() with filter:

var queryResult = await authorsSquidexClient.GetAsync(new ContentQuery
{
Filter = $“data/ArticleId/iv eq ‘{draftAuthor.ArticleId}’”
},
QueryContext.Default.Unpublished(true));

It returns a list of matched items - squidex models, e.g.
public Author: Content<AuthorData> { }
then
var matchedItem = queryResult.First();

So the matched item should have status properties as next:
matchedItem.Status = "Published"
matchedItem.NewStatus = "Draft"
but happens next:
matchedItem.Status = "Draft"
matchedItem.NewStatus = "Draft"

And it’s definitly is a bug. Because in all esle places - Status is Published and NewStatus is Draft. Only squidex client library returns double draft.

I cannot reproduce it, because I get the following result:

image (UPLOAD FAILED)

EDIT: I noticed it is a pure Client Library issue: https://github.com/Squidex/squidex-samples/commit/c2e790402d05fb74003ccabfb2222c72081d8cbf

Not sure, why it was introduced by that. I will revert it and introduce a new property.

2 Likes

Yes, looks like exactly that! Great thanks ahead for the fix.

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.