Habitat icon indicating copy to clipboard operation
Habitat copied to clipboard

Experience Editor: Changing associated content resolves datasources from wrong database.

Open rolek opened this issue 8 years ago • 2 comments

Consider the following scenario.

I am a developer on the project. I have just created a new view rendering, defined new datasource location under my site/Settings/Datasource. I am adding a newly defined view rendering to the current page in Experience Editor. The datasource location dialog does not show my defined datasource.

The cause: I have tracked the issue to the following class: SIteDefinitionsProvider

private SiteDefinition GetSiteByHierarchy(Item item) { var siteItem = this.GetSiteItemByHierarchy(item); return siteItem == null ? null : this.SiteDefinitions.FirstOrDefault(s => s.Item.ID == siteItem.ID); }

siteItem is from master database, s.item.id is from web database, resulting return statement returns the item from web database, when I am working in Experience Editor and adding / changing components.

This causes incorrect datasource locations for the component I am working on.

rolek avatar Feb 27 '17 19:02 rolek

Very interesting. Could you possibly describe how to recreate this bug?

Eldblom-zz avatar Mar 21 '17 23:03 Eldblom-zz

To reproduce: DO not publish anything yet.

  1. Create View Rendering, Set datasource to: site:
  2. Create DataSource under the Datasources folder, choose your newly created view rendering when asked.
  3. Configure the new datasource with template and location.
  4. Create or edit the page in Experience Editor. Add view from point 1.
  5. Set associated content. The Set Associated Content dialog will not show your location from point 3.

Now Publish the site. Try setting associated content for the view rendering that you just created. Everything works fine and datasource location shows up correctly.

rolek avatar Mar 22 '17 14:03 rolek