Skip to content

Conversation

@jan888adams
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Aug 7, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch invalidate-dependent-elements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jan888adams jan888adams force-pushed the invalidate-dependent-elements branch from 9dfee3b to cfd6107 Compare August 12, 2025 12:54
Base automatically changed from display-tags-in-symfony-profiler to main August 13, 2025 10:58
@jan888adams jan888adams force-pushed the invalidate-dependent-elements branch from 7fc57dd to 6aedd15 Compare August 20, 2025 10:16

$this->invalidateElement($element);

if (ElementType::Object === ElementType::tryFrom($element->getType())) {
Copy link
Member

Choose a reason for hiding this comment

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

Why only for objects?

Copy link
Contributor Author

@jan888adams jan888adams Aug 20, 2025

Choose a reason for hiding this comment

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

It wouldn’t make sense in every case.
If an object is required by a document, why should all sites that use this object be invalidated?
If a snippet is required by a page, why should all pages containing that snippet be invalidated?
I think we need to carefully consider in which cases this behavior actually makes sense.

Copy link
Member

@jdreesen jdreesen Aug 20, 2025

Choose a reason for hiding this comment

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

It wouldn’t make sense in every case.

You don't know that. Only the app will know, right?

If an object is required by a document, why should all sites that use this object be invalidated?

Probably because it is somehow used in the document, so when it's not invalidated it displays outdated data?

If a snippet is required by a page, why should all pages containing that snippet be invalidated?

Same reason: why should the page require the snippet if it doesn't use it? And if it does, and it isn't invalidated, it shows outdated data.

I think we need to carefully consider in which cases this behavior actually makes sense.

Here I'm with you. Maybe we need an (easy) mechanism that controls whether the dependencies should be invalidated or not (also: which ones?) 🤔

Copy link
Contributor Author

@jan888adams jan888adams Aug 21, 2025

Choose a reason for hiding this comment

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

Yeah, you are right. The examples were not selected carefully.

Indeed, it should be: a Document is required by an Object. That may or may not make sense, but it’s a case the user of the bundle could have control over.

Also, a Page being required by a Snippet doesn’t sound like a standard case. If we want to do that, it should be considered more carefully.

So the idea was: cases where an Object is required by another Object or by a Document are clear. The other cases are not standard and should not be included in our default behavior.

The best way to handle them is, as you said, through configuration.

@jan888adams jan888adams force-pushed the invalidate-dependent-elements branch from 48fa75d to ea6878b Compare August 21, 2025 11:05
@jan888adams jan888adams force-pushed the invalidate-dependent-elements branch from ea6878b to af41501 Compare August 21, 2025 11:17
$element = match (ElementType::tryFrom($required['type'])) {
ElementType::Object => $this->elementRepository->findObject($required['id']),
ElementType::Document => $this->elementRepository->findDocument($required['id']),
ElementType::Asset => $this->elementRepository->findAsset($required['id']),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to check if invalidating an asset makes sense.

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