The filters are not selected for correct instance in case of multiple PB instances.

Created on 10 March 2025, 25 days ago

Problem/Motivation

When we have multiple PB instances and if we select any category from Filter by category dropdown then the values are selected for the first instance in all the cases.

Steps to reproduce

Visit project-browser/project_browser_test_mock?instances=4 and select the categories for any of the instance except the first one and then you might notice that the categories are selected for the first instance and it's result are updated.

Proposed resolution

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India utkarsh_33

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @utkarsh_33
  • 🇺🇸United States phenaproxima Massachusetts

    We'll need a test for this (a new method of MultipleInstancesTest should suffice), and it's definitely a beta blocker.

  • First commit to issue fork.
  • Merge request !782Component specific filter key → (Merged) created by narendraR
  • Pipeline finished with Failed
    23 days ago
    Total: 3603s
    #445446
  • Pipeline finished with Failed
    23 days ago
    Total: 506s
    #445538
  • Pipeline finished with Failed
    23 days ago
    Total: 368s
    #445543
  • Pipeline finished with Failed
    23 days ago
    Total: 620s
    #445557
  • 🇮🇳India narendraR Jaipur, India

    I couldn't reproduce this issue in tests, although it was reproducible locally. This fix resolved the issue, and I updated the existing test to cover the scenario of selecting the second instance first.

  • 🇮🇳India utkarsh_33

    I can confirm that the issue is solved with this Fix.

  • 🇺🇸United States phenaproxima Massachusetts

    Fixed merge conflicts, and suggested an alternate (simpler) approach here that might work.

    The bigger problem, though, is that the test passes locally even against 2.0.x...so it's not catching the bug. :( The test needs to fail on 2.0.x without the patch.

  • 🇺🇸United States phenaproxima Massachusetts

    Another question: how is it that the existing test didn't catch this bug?

    At the bottom of the test method in 2.0.x, we are confirming that adding an additional category to the second instance produces a different list of results than the first instance. Why didn't this fail in 2.0.x?

  • Pipeline finished with Failed
    22 days ago
    Total: 497s
    #447079
  • 🇺🇸United States phenaproxima Massachusetts

    I did a little bit of investigating and discovered that the reason the tests aren't catching is because...even in 2.0.x, the test behaves correctly!

    And yet, if I put a sleep(30) at the top of the test, and then click around manually in Chrome...I am seeing the buggy behavior. In other words, this is a case where the human interaction of clicking on the checkbox causes the bug, but Mink's interaction with the checkbox does not.

    That leads me to believe that the problem is something to do with, maybe, the onChange function in MultipleChoiceFilter.svelte. There are some really dodgy DOM traversal/queries happening in showHideFilter to deal with focusing -- those seem very suspicious to me, and it's entirely possible that they're somehow looking at the wrong part of the DOM tree.

    I think we need to take a few steps back here and start with a test that unambiguously fails against 2.0.x. We're not going to have any other way to know for sure if we've fixed this bug.

  • 🇺🇸United States phenaproxima Massachusetts

    I can also confirm that if I pause the test at the beginning with a sleep(30) and click around, my proposed fix appears to prevent the bug.

  • 🇺🇸United States phenaproxima Massachusetts

    Ensuring credit is correct, as @narendra and @utkarsh_33 worked to reproduce this in a test while I was asleep.

  • 🇺🇸United States phenaproxima Massachusetts

    Figured out the problem -- clicking the label causes the problem; clicking the checkbox does not. The tests normally click the checkbox.

  • 🇺🇸United States phenaproxima Massachusetts

    Confirmed that tests catch the bug; the test-only job fails as expected.

  • Pipeline finished with Failed
    21 days ago
    Total: 1024s
    #447456
  • First commit to issue fork.
  • Pipeline finished with Failed
    21 days ago
    Total: 913s
    #447521
  • Pipeline finished with Skipped
    21 days ago
    #447551
  • 🇺🇸United States chrisfromredfin Portland, Maine

    tests are passing, PHPStan issue present in 2.0.x-HEAD

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024