Problem/Motivation
Split off from https://www.drupal.org/node/2215857#comment-11767180.
Stella described the follow steps to reproduce:
My scenario: 5 filters (2 fixed, 3 exposed)
Steps:
- Add 2 new filter groups.
- Leave the 2 fixed filters (filter #1 and #2) in group #1.
- Move filter #3 to group #2 (this is an OR)
- Move filters #4 and #5 to group #3
Result: everything is ok except for filter #5 which stays in group #1.
Caveat: if I move filter #5 to the end of group #3 it doesn't work as above, but if I move it to the top of the group, it stays in group #3. Then after a save, I'm able to move it to the desired position at the end of the group.
A second symptom of this, is that you ARE allowed to drag to zones that shouldn't be available.
Cause:
If you switch to manual mode for dragging you can see the selectbox for the group is not updated.
Proposed resolution
Update the group selectbox correctly.
Remaining tasks
- Get related issues committed as this issue depends on it.
- Write test (extend test in #2717629: Add filter group for a View fails)
- Write patch
User interface changes
-
API changes
-
Comment | File | Size | Author |
---|---|---|---|
#58 | apply-changes-to-es6-2825446-58.patch | 723 bytes | lauriii |
#49 | 2825446.44_49.interdiff.txt | 2.05 KB | dww |
#49 | 2825446.38_49.interdiff.txt | 1.45 KB | dww |
#49 | 2825446-49.patch | 4.42 KB | dww |
#49 | 2825446-49.test-only.patch | 3.46 KB | dww |
Comments
Comment #2
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #3
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI created a test based on the version in #2215857: Behaviors get attached to removed forms (which in turn is based on the not-yet-committed #2717629: Add filter group for a View fails).
It validates updating the group. Interdiff is for the difference from the #2215857: Behaviors get attached to removed forms patch.
Lets check if the patch fails on do.org as well.
Comment #5
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedI think I found the problem, there was a weird check on the previous row beeing the group title row, which obviously is an incorrect check when not adding an item as the first item.
The patches from the related issues are required to make the test pass (which it now does here). We'll have to wait on the other issues and then report a new patch based on what's in core then.
In the meantime, I'd love feedback on the test and patch.
Comment #6
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedComment #9
dmsmidtThis is still an actual problem (8.4.x). But there is more wrong with drag and drop in the rearrange form than the title suggests.
The problem renders the UI pretty useless, marking this as major.
Drag and drop when creating a new group is problematic, you can drag to zones that shouldn't be available:
For existing groups, the group ID is not updated after a drop in a different group:
Comment #10
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedThis behavior is exactly what the patch is for, it should fix both issues.
The issue was waiting on the related issues and there in now. There's another issue which alters the test again pending here: #2832672: [PP-1] Upgrade jcalderonzumba/* for better test performance. I'll keep an eye on this issue and reroll a patch after this issue has been fixed.
Comment #11
michielnugter CreditAttribution: michielnugter as a volunteer and at Synetic commentedSetting to postponed and linked the correct issue (fix was split from driver upgrade issue): #2856047: Avoid random failures in JavascriptTestBase when testing functionality in a dialog.
Comment #14
mgerbaultUp !
Doesn't work on Drupal 8.5.x
:(
Is there a patch ?
Comment #16
PanchoHere's patch #6 rerolled against HEAD. I also think we shouldn't postpone this major bug for a phpunit-related issue that has not been commented on for 12 months.
Comment #17
PanchoBy manual testing I can confirm the latest patch does fix the original problem with moving a filter to the end of the previous filter group. :)
However it doesn't fix the additional bug reported in comment #9 that renders the drag-and-drop interface useless for creating a new filter group.
IMHO let's get the original bug fixed first, and then move on to the second one in #3024891: Drag-and-drop builder won't let me arrange filter groups.
Comment #19
PanchoNew version using WebDriverTestBase instead of the deprecated JavascriptTestBase, otherwise still the very same patch from #9 rerolled against HEAD. Don't know if the one test failure disappears, otherwise we need to look into that test again.
Comment #20
PanchoManual testing shows the failing test correctly detects the additional bug, see enclosed test-only patch.
Comment #21
LendudeThe test here passes with the latest patch from #2215857: Behaviors get attached to removed forms applied too
Comment #22
PanchoWow. So I tried to merge the two patches (#20 and #2215857-44: Behaviors get attached to removed forms) for testing. Hope I did it well so the tests pass and are significant.
Comment #24
anavarreTried to apply the merged patch in #22 against a test code base and all is well.
Before the functionality was completely broken / unusable both from a UX and feature POV. With the patch I can add a new group and easily move rows around in the new group. More importantly things are finally saved and working correctly. I've tested exposed filters and I can return (exposed) results correctly without any issue. Good job!
I see #2215857: Behaviors get attached to removed forms was recently updated. Should we update the merged patch accordingly for further testing?
Comment #25
PanchoSure. Go forward!
Comment #26
anavarreUpdated the merged patch.
EDIT: actually I think I've messed up the merge here. Please ignore.
Comment #27
anavarreNew attempt at merging the 2 issues.
Comment #28
anavarreThis should be the most up-to-date combined patch.
Comment #29
dww#2215857: Behaviors get attached to removed forms is now in core, both 8.6.x and 8.7.x. This needs reroll and cleanup now that a "combined patch" would no longer apply.
Thanks!
-Derek
Comment #30
PanchoCool that the other issue got in!
This is a bug, so fix in 8.6.x-dev first.
Comment #31
PanchoJust the fix, no further tests.
Comment #32
anavarreI installed HEAD to see what the new behavior was like after #2215857: Behaviors get attached to removed forms got committed. To my surprise, everything seems to be working as expected 🤨. I'd like someone else to please confirm/deny this statement because it looks odd to me it'd work all of a sudden without the patch from this issue.
Comment #33
Pancho@anavarre: You may have above patch in your composer.json, do you? For me the bug still exists with #2215857-49: Behaviors get attached to removed forms applied but #31 not. Please check again.
Otherwise I would reintroduce the tests, so we can get this to RTBC.
Comment #34
PanchoComment #35
anavarre@Pancho: no, I tried from scratch with 8.7.x locally and tried again just now with a remote test install. Still couldn't reproduce the issue.
I've switched this to 8.7.x because this is the version against which we should be fixing the bug first and leave it up to core committers to backport to 8.6.x - Could you please try with 8.7.x and report back if you see anything different?
Comment #37
LendudeThe test-only file in #20 still fails, so that would indicate the problem still exists in HEAD
Comment #38
LendudeHere we go
Comment #40
LendudeUpdated the IS and title (finally, sorry @dmsmidt!)
Comment #41
anavarreI understand we have a test-only patch that demonstrates the problem, but at the risk of being a PITA here, I still cannot reproduce against 8.7.x - I tried several fresh instances with different stacks, and ran
composer clear-caches
before installing several times as well. I've attached a test view which takes taxonomy term names and TIDs.I can create filter groups just fine on my end, without the patch in this issue. Perhaps I'm doing something wrong but I cannot see what exactly ATM.
Comment #42
dwwRe: #38 nice work! Almost RTBC...
Fix looks great!
Why are we removing this test coverage? Seems unrelated to the fix here. :/
I don't remember seeing us put issue nids into comments like this. The nid is also #2717629: Add filter group for a View fails which on a very quick skim doesn't seem related to what this assertion is testing for. Long day, please excuse me if I'm confused. ;)
Re: #41: I tested manually, and yes, it's still broken in 8.7.x HEAD. To see the bug:
I'd make a series of screenshots but that'd take too long. ;)
I'll RTBC as soon as #2 is addressed. #3 is just informational / nit.
Thanks! This bug has been bothering me for ages, will be very happy to see it finally fixed in core. :)
Cheers,
-Derek
Comment #43
anavarreThanks, your step-by-step helped. I wasn't reproducing exactly like that (less filters and not paying attention to the weight). Very glad to see this fixed as well.
Comment #44
anavarreAddressed #2 to get the ball rolling. As to #3, it seems we're adding NIDs in other core files already. E.g.
Comment #46
anavarreSeems there was a reason why those lines got removed. Re-tested #38 and it still returns back green.
Marking RTBC to solicit core committers opinion on the patch readiness.
Comment #47
dwwSorry, that's not really how RTBC works. ;) If we have known issues, we sort them out ourselves before we bump to RTBC.
Maybe @Lendude can comment on this point? What's up with #42.2?
It seems like that assertion has nothing to do with this issue. Not clear why re-adding it caused #44 to fail, especially since on a quick skim it doesn't seem like it failed in the re-added assertion.
Comment #48
dwwOkay, I dug a little deeper. #44 re-added the hunk, but in totally the wrong place. ;) No wonder it's failing. I'll re-roll properly. Stay tuned.
Comment #49
dwwOkay, that's better. The assertion in question is a stand-alone assertion and can't be mixed in with a new page get in the middle of all the filter group stuff the rest of this test case is doing. Moved it to the very top of
testFilterCriteriaDialog()
. This now passes locally. Bot should agree.Also, at @Lendude's request in Slack, I'm removing the nids from the comments (#42.3). Confirmed that we don't (normally) do that and if folks want to find the nids, they can
git blame
.Interdiffs relative to #38 and #44 for the interested reader.
Enjoy,
-Derek
Comment #51
anavarre🤦wrong copy paste, sorry!
Thanks for re-rolling this cleanly. Back to RTBC now that this was sorted out.
Comment #52
LendudeRTBC++
Comment #56
webchickMmm. Love the taste of patches that are one-line fixes and bazillions of tests. ;)
Committed and pushed to 8.8, and since it's a major bug fix, also backported to 8.7. Thanks!
Comment #58
lauriiiThis change should have been applied to the ES6 file, and then compiled. At the moment, whenever you compile JavaScript, this change gets reverted.
Comment #59
LendudeApplied the patch, compiled JS, no other changes then the patched es6 file, so this checks out. Sorry for missing this!
Comment #60
dwwGood point! Whoops, we missed. #58 is indeed RTBC.
Thanks/sorry,
-Derek
Comment #63
webchickOopsie. :( Thanks for the fix!
Committed and pushed to 8.8.x and 8.7.x. Thanks!