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

[5.x] Augmentation Adjustments #9574

Conversation

JohnathonKoster
Copy link
Contributor

@JohnathonKoster JohnathonKoster commented Feb 23, 2024

The PR adjusts some internal Augmentation logic. Its primary goal is delay resolving these original values as long as possible:

https://github.com/statamic/cms/blob/4.x/src/Data/AbstractAugmented.php#L51-L61

It also adds a new toDeferredAugmentedArray which will pass around an InvokableValue object that will perform similar logic to what exists now, but only when the value is needed somewhere (whether that is via. raw, value, or any other method that uses those). This to augmentation method is intended to be internal, and have refactored some internal areas to use it instead (core modifiers, the Cascade's globals, etc.). Calling all() on an existing augmented collection will resolve these invokable values like normal (such as for JSON responses, or third-party code relying on that behavior).

Another big change was to reduce the number of calls to blueprintFields made. This was done by making a single call when using select: https://github.com/statamic/cms/pull/9574/files#diff-3587a85d40c591a1d37c917c8eb3420091c9cd5203f6836bf71467323dde9deeR38-R43. Additional logic was also added to revert to calling it again when retrieving values using get directly, or via. other methods.

A few notes:

  • This has impacts on the dump tag and modifier, but that can be sorted out separately if this all checks out (thinking to just force resolve those values when using the tag or modifier)
  • There is some opportunity with the remaining wrapValue method, but need to think on that some more and can be a separate item, if needed. This has been completed in [5.x] Augmentation performance improvements #9636

@JohnathonKoster JohnathonKoster marked this pull request as draft February 23, 2024 00:09
@JohnathonKoster JohnathonKoster mentioned this pull request Feb 25, 2024
37 tasks
Positive improvements across a variety of different situations, particularly the `group_by` modifier
@JohnathonKoster JohnathonKoster marked this pull request as ready for review February 28, 2024 02:44
Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

Please target master.

@JohnathonKoster JohnathonKoster changed the base branch from 4.x to master March 8, 2024 01:02
@jasonvarga jasonvarga dismissed their stale review March 11, 2024 17:00

Requested changes were made.

@jasonvarga
Copy link
Member

Closing in favor of #9636

@jasonvarga jasonvarga closed this Mar 13, 2024
@jasonvarga jasonvarga deleted the deferred-method-augmentation branch March 13, 2024 17:40
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.

None yet

3 participants