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

Planting quick form does not always remember the last season #834

Closed
mstenta opened this issue Apr 26, 2024 · 3 comments
Closed

Planting quick form does not always remember the last season #834

mstenta opened this issue Apr 26, 2024 · 3 comments
Labels

Comments

@mstenta
Copy link
Member

mstenta commented Apr 26, 2024

Reported by a user via email, and replicated by myself in a test instance. I need to investigate more to determine the root cause, but I have a hunch that it has something to do with the way the entity_autocomplete widget's $form_state values different for new/existing entities in this code:

// Remember the selected seasons for future reference.
$season_ids = [];
foreach ($plant_asset->get('season')->referencedEntities() as $entity) {
$season_ids[] = $entity->id();
}
if (!empty($season_ids)) {
$this->state->set('farm.quick.planting.seasons', $season_ids);
}

@mstenta mstenta added the bug label Apr 26, 2024
@mstenta
Copy link
Member Author

mstenta commented Apr 29, 2024

Hmm now that I'm digging into this, I have been unable to replicate it again. 🤔

I was in a bit of a rush when I tested originally, so it's possible that I didn't actually replicate it the first time. I will try a few more things, and I've asked the original reporter to see if they have more information, so I will report back...

@mstenta
Copy link
Member Author

mstenta commented Apr 29, 2024

Closing this for now, but will reopen if we're able to replicate it consistently...

@mstenta mstenta closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
@mstenta
Copy link
Member Author

mstenta commented Apr 29, 2024

Update: we figured out the cause. The user was trying to change "2023 (234)" in the form text field to "2024 (234)". But since "(234)" was still being included, it used that term ID ("2023") instead.

We really should remove those IDs... https://www.drupal.org/project/farm/issues/3263694

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

No branches or pull requests

1 participant