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

Previewing a submission removes tags #1264

Open
jcs opened this issue Mar 24, 2024 · 1 comment
Open

Previewing a submission removes tags #1264

jcs opened this issue Mar 24, 2024 · 1 comment

Comments

@jcs
Copy link
Contributor

jcs commented Mar 24, 2024

In at least Safari in iOS 17.3, filling in story details and selecting tags, then tapping Preview generates a preview with no tags, and the tags are removed from the form field.

IMG_0531
IMG_0532

@aorady
Copy link

aorady commented Apr 22, 2024

I've narrowed this down to the addition of the .includes(:tag) step in Story.tags_a (line 683 of models/story.rb).

This appears to be because includes filters out taggings that are not yet written to the db, which applies to both :preview and :new when rendering a partially filled form/preview of a story not yet saved by the user.

This original change appears to have been introduced ~1 month ago in hopes to address an n_plus_one failure. Removing this line indeed causes n_plus_one failures to return for stories with multiple tags, both in :new and :edit of the story controller. While it doesn't solve the performance issue, I was able to work around the exception in dev mode by calling Prosopite.finish before hitting the db in both those functions.

Happy to send a pull request unless someone prefers to take this or address a fix in a different way. I have to admit I'm not happy with my abuse of Prosopite.finish(), and I was unable to figure out exactly where to place a pause/resume to prevent the failure (not for lack of trying either :).

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

No branches or pull requests

3 participants