Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small gotcha with snippets #836

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

onno-timmerman
Copy link
Contributor

When using snippets and translations there is a gotcha you might encounter. This might save somebody couple of hours figuring it out.

Imagine you have a page with related tags added via snippets, and you want to query all pages with a specific tag.

When synchronous translation is enabled, the tag will refer to the default language. However, if the user turns off
synchronous translation, the tag will refer to the page’s language. This could mean the user references a translated tag
within the translated page, causing the query to miss some pages tagged with the original tag.

To solve this, you can query both the default language and the current language, then filter based on the active
language.

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.07%. Comparing base (caf14b8) to head (e625887).

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #836    +/-   ##
========================================
  Coverage   93.07%   93.07%            
========================================
  Files          47       47            
  Lines        4144     4144            
  Branches      704      529   -175     
========================================
  Hits         3857     3857            
  Misses        173      173            
  Partials      114      114            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,19 @@
# Snippets and Synchronization
Imagine you have a page with related tags added via snippets, and you want to query all pages with a specific tag.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a code snippet illustrating this?
it will help people contextualize the scenario

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. I added a code snippet at the bottom ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tags as snippets, and how they are added to the page

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added full example, hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants