Skip to content

Conversation

@sudeeptarlekar
Copy link
Member

When user imports the presets. Chipmunk shows number 1 next to the filename which suggests that filter is already been used. This commit fixes that bug.

Fixes: #2430

@sudeeptarlekar sudeeptarlekar force-pushed the bug/2430/use_counter_in_presents branch 2 times, most recently from 85f6a0f to b99af87 Compare October 15, 2025 15:25
When user imports the counter in the Chipmunk, we show the counter
which indicates how many times imported filter is used. When user
clicks on the counter then counter keeps increasing even if filter
is already applied.
This commits fix that by checking if filter is applied or not,
if filter is used then, counter will not be increamented.

Fixes: esrlabs#2430
@sudeeptarlekar sudeeptarlekar force-pushed the bug/2430/use_counter_in_presents branch from b99af87 to 82d4f8b Compare October 15, 2025 15:32
@sudeeptarlekar sudeeptarlekar marked this pull request as ready for review October 15, 2025 15:32
Copy link
Member

@AmmarAbouZor AmmarAbouZor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested that on my machine. and I think the current behavior isn't entirely correct, because now we are getting that the number of used filters is set to zero even though the filter is currently in use (See screenshot). Then after I click on the preset the counter will get into 1 and then stop increasing.

This is easily reproduceable by just applying a filter or opening a session with saved filter in it

image

@AmmarAbouZor
Copy link
Member

Also please check why the lint CI is failing

When user loads the file and collection is already loaded, counter
for collection is set to 0, this commit fixes that bug.
@sudeeptarlekar sudeeptarlekar force-pushed the bug/2430/use_counter_in_presents branch from b7286dd to da79032 Compare October 16, 2025 15:32
Copy link
Member

@AmmarAbouZor AmmarAbouZor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes. I've added some comments regarding the code changes and here are some points form testing the changes:

  • We need to think about highlighting the used one because the current color doesn't affect the readability of the texts. Can you consider leaving the background color the same but make the title of used filters bold instead?
  • I ran into situation when I imported filters and set list filter to All where some presets have (0) and others don't have it
image

Comment on lines +65 to +67
if (def.used > 0) {
def.used = 0;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just set the value to zero without having an if branch.

);
}

// TODO: Remove this function as this is not used anywhere
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can resolve the TODO then by removing the function

collection.last = Date.now();
}

public ignoreAll() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need rename this to something more precise like resetUsedCounters.

@AmmarAbouZor
Copy link
Member

AmmarAbouZor commented Oct 20, 2025

@sudeeptarlekar We need to consider this whole approach because the counter of the presets is globally for all open tabs (See screenshot). In that case, the used counter should be allowed to have values more than 1 and we need actually to increase it.

I would suggest to fix increasing the counter on mouse click and leave the current behavior as in master for this part. Maybe in a new PR?

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Presets' names start with counter and clicking on it increases the counter

2 participants