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
Fieldtype field()->parent() populated with wrong entry #9630
Comments
I've just tested this in my sandbox site and wasn't able to replicate the issue 🤔 Where were you seeing the wrong entries being populated - in the entry publish form? |
@duncanmcclean it took me a while to narrow it down further: i could replicate the issue in a fresh install with a structured collection with dates enabled. So both structure and publish dates need to be enabled. Also use a proper cache driver (like redis), not the array cache driver! Collection:
Blueprint:
App/Fieldtypes/ParentTest.php
resources/js/components/ParentTest.vue
You would expect that the ID shown on the publishing form is the ID of the entry. On the first page load after clearing cache and stache it more or less is, afterwards it is some other ID. |
Possibly related to #9633 |
Bug description
Since 4.51.0 the field()->parent() is set to some other entry.
I have a custom fieldtype which needs the entry id to populate data from an API. I do this in the preload() method using $this->field()->parent()
Since 4.51.0 this resolves some random entry, but not the correct one. Most of the time the last entry in the structure tree (I noticed the bug in a structured collection).
How to reproduce
Use a custom fieldtype and check the parent:
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
Runtime (default)
Additional details
No response
The text was updated successfully, but these errors were encountered: