Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: Reset button still enabled after restoring the original state manually #6

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

lcarrasco-xdev
Copy link
Member

Steps to reproduce:

  1. Add an initial filter to the filter component in the code. --> Reset button disabled.
  2. Add a custom condition in addition to the initial condition in the ui. --> Reset button enabled.
  3. Remove the custom condition. --> Reset button still enabled.

Expected behavior: After removing the custom condition in step 3, the reset button should no longer be enabled.

…deactivated if the initial state was restored.
Copy link

sonarcloud bot commented Oct 18, 2024

Comment on lines +526 to +534
final List<ChipBadgeExtension<FilterCondition<T, ?>>> initialChipBadgesCopy
= new ArrayList<>(this.initialChipBadges);
final List<ChipBadgeExtension<FilterCondition<T, ?>>> chipBadgesCopy
= new ArrayList<>(this.chipBadges);

// Check if just the initial filter are currently applied. Then enable/disable the reset button as
// appropriate.
this.btnResetFilter.setEnabled(
!new FilterComponentUtl<T>().equalLists(initialChipBadgesCopy, chipBadgesCopy));
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 the comparison can be done a in a simpler way using something like this:

this.initialChipBadges.stream()
	.map(ChipBadge::getBadgeId)
	.collect(Collectors.toSet())
	.equals(this.chipBadges.stream()
		.map(ChipBadge::getBadgeId)
		.collect(Collectors.toSet()))

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.

2 participants