Skip to content

Issue with opensak.filter not refreshing the grid #1325

Closed

Description

@GeePa67

Description

I have been trying to reproduce this one consistently but I can't. I am finding that a lot of time since maybe beta 3 o4 4 that in the attached macro with the attached database the cache list does not refresh for the right caches. I am pretty certain it is just a list refresh issue because opensak.filter always returns the correct number of records when I log that. I have been using filter words of rusty and lime and bridge. I feel it is a refresh issue because also the html comes back with the correct list. Also, the list shows a highlighted red x in the toolbar even though all caches are shown. I cannot always reproduce this behavior.

I have attached the macro and database

find-words-in-name.zip

The database zip is failing to upload. Is there an alternative way to send? File is 35 mb

Steps to Reproduce

Try running the macro again and again using one of the three words I gave each time and sometimes clearing the filter between runs and sometimes not. Eventually I get in a situation where the grid will always show all caches.

Expected Behavior

The grid should only show the correctly filtered caches

Environment

Windows 11 Pro 10.0.26300 Build 26300. Opensak OpenSAK 1.23.0-beta.5

Activity

  1. GeePa67 commented on Nov 16, 2026

    @GeePa67
    Author

    I tried making a smaller database by copying my original database and deleting some of the caches from it, but on the smaller database I cannot reproduce the issue. I'm not sure if the problem is related to database size or maybe my test database is corrupt in some way.

  2. GeePa67 commented on Nov 16, 2026

    @GeePa67
    Author

    More information. I commented out line 694 of the macro because the clear_filter was really not necessary and now I can no longer reproduce the issue. Very strange.

  3. nagisml commented on Nov 16, 2026

    @nagisml
    Contributor

    @GeePa67 Thanks for the detailed report. I could reproduce this reliably on 1.23.0-beta.5, and your finding about line 694 was the key clue.
    As this is a race condition bug, there is no 100% certainty, but maybe you can confirm the below and later the fix in the next beta.
    Cause
    It's a race between opensak.clear_filter() and opensak.filter{}:

    1. clear_filter() starts loading the whole, unfiltered list in the background.
    2. opensak.filter{} fills the grid right away with the correct result. That's why the count it returns and your HTML are always right.
    3. When the macro finishes, the unfiltered list from step 1 arrives late and overwrites the grid with all caches. The filter is still active, so the red ✕ stays lit.

    Why it's intermittent
    opensak.progress lets the app process pending events while your loop runs. If the background load finishes during the loop, it arrives before filter{} and does no harm. If it finishes after the last progress update, it overwrites the filtered list. Loading every cache from a large database takes longer, so the bug shows up much more often there than on a small test copy.

    Workaround
    Until it's fixed, leave out the opensak.clear_filter() call, as you already found. Your macro reads the caches with opensak.caches{} before that line anyway.

    Fix
    Applying a filter should discard any list load that is still running, so a late result can't overwrite it. I'll prepare a fix with a regression test.

  4. added a commit that references this issue on Nov 17, 2026
    83efa34
  5. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    @GeePa67 This was fixed in PR #1326 and will be included in the next beta release. 🎉

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions