-
Notifications
You must be signed in to change notification settings - Fork 16
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
Refactor HTMX Implementation to avoid duplicate create forms #1119
Conversation
@shapiromatron ready for a draft review--still have UDF binding and mgmt task viewsets left |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were a few bugs I witnessed when testing this out:
- The cancel button doesn't work on label create forms in the HAWC Prime flavor. More specifically it looks like the hidden css is being overridden by flex css after conferring with Casey.
Other optional changes:
- I noticed usage of classes for the create row htmx trigger. In practice this should only be a single element, so I'd personally prefer using an id, but it doesn't really make a difference with functionality. This change may be a bit branching so I'd be fine if it wasn't addressed.
Edited this comment after some bugs turned out to be local.
@rabstejnek I can't recreate any of these bugs. The first two are css-related, so a hard refresh might fix it. Not sure about the last bug. I'll keep trying to replicate the bugs and reach out for a meeting otherwise. I'll also look into using IDs for the create rows, that's a good call |
OK the label cancel bug was some weird issue with the 'hidden' class being overwritten by 'd-flex' class with PRIME style. Good catch! Glad we're fixing this, not sure where else this bug might have been present... |
Ok, I tried swapping the |
Seems reasonable to me, I think this looks like it's ready for my review. Thanks yall!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally, it works great, and fixes the bugs I introduced with my alternative approach. Since the selectors on pages with multiple creation forms use a dual selector, .foo.bar
, I think this should work fine in practice. https://stackoverflow.com/a/3772305/906385
Nice job!
Refactors our HTMX views to avoid having multiple create forms at once, since this introduced bugginess.
The general pattern is this (refer to lit workflows as a good example):
create-row hidden
hx-target=".create-row" hx-swap="outerHTML"
create-row
if this is a create and not an update (so that duplicate button presses will replace this item). Don't delete the form if a user hits cancel, just hide.