verbb / vizy

A flexible visual editor for Craft CMS
Other
44 stars 8 forks source link

Querying entries from entry field uses wrong siteId #319

Open jan-dh opened 1 month ago

jan-dh commented 1 month ago

Describe the bug

image

As you can see in the image; the siteId that's being used in the DB query is 9, the currentSite.id is 8.

I can manually work around this like this:

{# Get ID from the query #}
{% set id = one_cta.id[0] %}
{# Manually query craft with the id #}
{% set cta = craft.entries.section('cta').id(id).one() %}
{% if cta %}
  <pre>
    {{ dump(cta.title) }}
  </pre>
{% endif %}

Steps to reproduce

  1. Create a new vizy block with an entry field type
  2. Link an entry
  3. Output the templates with node.renderHtml()

Craft CMS version

4.12.8

Plugin version

2.1.23

Multi-site?

Yes

Additional context

The site that is used in the DB query is from another sitegroup

engram-design commented 1 month ago

Can you provide any further clarification on the entries picked? Were they from the same site, or cross-site?

We don't actually store the site for the picked entries (that's because the Craft Entries field doesn't do that). But wondering if you can post your Entries field (the one used in your Vizy block) settings so I can confirm?

jan-dh commented 1 month ago

The entries selected are indeed from the same site. So entry I link the other entries from: siteId:8 Entries I link: siteId: 8

Field type: Entries Sources: 1 channel called - CTA's

image
engram-design commented 1 month ago

Thanks for confirming. Still struggling to reproduce that, but will keep trying on my end.