sugarlabs / musicblocks

Music Blocks -- A musical microworld
https://musicblocks.sugarlabs.org/
GNU Affero General Public License v3.0
558 stars 758 forks source link

Search not working on Master Branch #3833

Open pikurasa opened 6 months ago

pikurasa commented 6 months ago

Description

I noticed this a few weeks ago. The search on the master branch is no longer working.

It still works on the version on https://musicblocks.sugarlabs.org/

Expected Behavior

Search should work.

Screenshots

Various tests on the master branch and https://sugarlabs.github.io/musicblocks/ Screenshot from 2024-03-19 15-07-21 Screenshot from 2024-03-19 15-01-01 Screenshot from 2024-03-19 15-10-21

How to Reproduce

  1. Checkout master branch (currently 7f231ce01 fix(background): bacground of loader (#3832)) or go to https://sugarlabs.github.io/musicblocks/
  2. Type something into search
  3. Possible choices will not display

Console log Errors:

I do not see anything in the logs.

Environment:

Tested on Chromium on a Debian distro.

Ashish020202 commented 6 months ago

Hello @walterbender @pikurasa I think this behaviour after #3782 pls check once. As its a depreciation fix and long changes not able to find what actual problem is .

walterbender commented 6 months ago

Just did some testing. Seems it is both due to changing the jquery version and adding the "try/except" glue around doSearch. Reverting both the jquery version and removing the glue fixes the problem. But not yet sure what the root cause is.

Ashish020202 commented 6 months ago

yes the acutual problem arises from there but as this is big changes unable to figure out where should be actual problem

harshuttamchandani commented 6 months ago

So I found a few interesting things that might help with this issue. I am also able to replicate this issue on https://musicblocks.sugarlabs.org/ once in a while. To me, it seems like some kind of race condition. This issue exists even before the commit ce127c748d7430c2fd89e7e28febeae2809836d0 Looks like the following script block is redundant in functionality. There is no global doSearch() function. However, the presence of this block is helping in order of execution of the scripts in some non-deterministic way.

<script type="text/javascript">
            $(document).ready(function() {
                doSearch();
            });
        </script>

in index.html even if we change the doSearch() function to a random function name the search functionality works correctly.

<script type="text/javascript">
            $(document).ready(function() {
                abcd();
            });
  </script>

However, if I remove this block I do face the issue where the search functionality doesn't work. Upgrading jQuery has exacerbated the race condition though doesn't seem to be the actual cause of the problem.

Attaching the screenshot of this issue on musicblocks.sugarlabs.org musicblock site console log