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

Tags Field Clears on Form Error in New and Create Actions Using acts_as_taggable_on #2724

Open
4 of 11 tasks
artero opened this issue Apr 26, 2024 · 3 comments
Open
4 of 11 tasks

Comments

@artero
Copy link

artero commented Apr 26, 2024

Describe the bug

When submitting a form for creating or updating a Resource, if the form encounters an error and re-renders, the tags field does not remember the previously entered tags and appears empty. This issue occurs with tags in a model using acts_as_taggable_on.

Steps to Reproduce

  1. Navigate to the 'new Resource' page for a resource with acts_as_taggable_on and the tag field configured.
  2. Fill out the form including some tags in the 'tags' field.
  3. Intentionally make a mistake in another field to cause the form submission to fail.
  4. Submit the form.
  5. Notice that upon form error, the 'tags' field is rendered empty instead of displaying the previously entered tags.

Expected behavior & Actual behavior

Expected behavior: After form submission errors, the 'tags' field should display the tags that were entered prior to submitting the form.

Actual behavior: The 'tags' field is empty after the form re-renders due to validation errors.

Models and resource files

#  resource file:
field :tags, as: :tags, acts_as_taggable_on: :tags,
             close_on_select: false,
             suggestions: -> { PodcastEpisode.tags_suggestions },
             enforce_suggestions: true,
             only_on: %i(new show edit)
# model file
class PodcastEpisode < ApplicationRecord
    acts_as_taggable_on :tags
    # Additional model configurations and methods...
end

System configuration

Avo version: v3.6.0

Rails version: 7.0.4

Ruby version: ruby-3.1.2

License type:

  • Community
  • Pro
  • Advanced

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

Additional context

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)
@adrianthedev
Copy link
Collaborator

Thanks for reporting. We'll check on our end next week.

Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

@github-actions github-actions bot added the Stale label May 14, 2024
@adrianthedev
Copy link
Collaborator

Can you please check the latest version @artero and let us know if this still happens?

@github-actions github-actions bot removed the Stale label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants