Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[5.x] Improve recursive behavior when using route data in computed values #11855

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

Open
JohnathonKoster wants to merge 3 commits into statamic:5.x
base: 5.x
Choose a base branch
Loading
from JohnathonKoster:improvement/prevent-recursion-when

Conversation

Copy link
Contributor

@JohnathonKoster JohnathonKoster commented Jun 7, 2025

This PR fixes the issue described in #11853. When a computed value triggers the routeData method and the collection has a structure, you can end up in an infinite loop when fetching the entry.

This PR wraps computed values in a Value object to defer their execution only when resolving routeData. This is accomplished with two new methods:

  • getComputedData
  • getValues

Both of these methods allow the caller to wrap computed callbacks in a Value object. These methods are now used in the existing computedData and values methods. This was done to keep the signatures of these methods the same.

It will still be possible to cause infinite loops, depending on what the user is doing. The changes in #11854 will help with those scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@edalzell edalzell edalzell left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /