U4-9849 - Query Builder not working in template editor. Always returns Model.Content.Site().Children()

Created by Paul Seal 03 May 2017, 09:05:04 Updated by Shannon Deminick 24 May 2017, 05:41:10

Subtask of: U4-9609

I was trying to use the new query builder in the home template 7.6.0 and it was returning the same query every time. Model.Content.Site().Children()

What did you expect to happen? I expected it to be different for each option I picked.

What actually happened? I got this every time. Model.Content.Site().Children()

See attached gif for the steps I took.

1 Attachments

Comments

Claus Jensen 04 May 2017, 13:12:43

The localizationService now returns a promise instead of a string so the way this was used in the QueryBuilderController, caused the yet unresolved promise to be set as a property on the base query model object.

This resulted in the base query object (until overridden by setting "content type" and "from node" via the UI dialog) to have a promise objects instead of strings in these properties. When this was sent to the endpoint, the model binder would fail to parse the property as a string since it looked like an object - causing the entire model binding to fail and therefore just returning the base result of Model.Content.Site().Children().

Have changed this so the init function will not run until the promises for localization has been resolved, therefore allowing the base query object to be instantiated correctly.

Have also added some missing nullchecks in the endpoint action as these were missing.

PR: https://github.com/umbraco/Umbraco-CMS/pull/1931


Mikkel Holck Madsen 08 May 2017, 07:05:52

PR Merged


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category: Editor

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.0

Due in version: 7.6.1

Sprint: Sprint 58

Story Points:

Cycle: 1