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

fix: optimize condition editing logic in DatasetsFilterSettingsComponent #1673

Merged
merged 6 commits into from
Nov 29, 2024

Conversation

Junjiequan
Copy link
Contributor

@Junjiequan Junjiequan commented Nov 27, 2024

Description

This PR addresses the following issues:

  1. Fixes a UI issue in the filter where editing a scientific metadata condition caused the previous condition to disappear.
  2. Fixes duplicate creation of scientific metadata conditions
  3. Resolves an issue where the input value changes only when the input field is focused again.
image image image

Motivation

Background on use case, changes needed

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Optimize the condition editing logic in the DatasetsFilterSettingsComponent to fix UI issues related to scientific metadata conditions and input value changes.

Bug Fixes:

  • Fix a UI issue where editing a scientific metadata condition caused the previous condition to disappear.
  • Resolve an issue where the input value changes only when the input field is focused again.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Junjiequan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Removing ChangeDetectionStrategy.OnPush might fix the immediate issue but could lead to performance problems. Consider investigating why OnPush was causing problems and fixing that instead.
  • Please provide more detailed information in the PR description, particularly in the 'Fixes' and 'Changes' sections, to help reviewers understand the scope and impact of the changes.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Collaborator

@martin-trajanovski martin-trajanovski left a comment

Choose a reason for hiding this comment

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

Seems fine to me. Maybe we can write a short e2e test that covers this bugfix or if you think it is not so critical we can cover it in some other scenario later.

(config) => isEqual(config.condition, data),
);
if (existingConditionIndex !== -1) {
console.log("Condition already exists");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to console.log here or we just want to return if the condition is met?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out.
Ideally, we should show a snack bar popup with the msg to let the user know what's happening, but I've noticed that we have disabled the snack bar on staging and production.
I've kept the waning in a console.log, in case we want to improve the snack bar popup in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is a good idea to try to use the snackbar and try to communicate with the user if possible instead of just console.log it silently. Aren't we able to fire the snackbar and add a message even if other notifications are disabled for requests in the interceptor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha, good point. Maybe we can import the snackbar module within the component, instead of relying on the global snackbar

@Junjiequan Junjiequan merged commit 27eb0ad into master Nov 29, 2024
6 checks passed
@Junjiequan Junjiequan deleted the filter-ui-fix branch November 29, 2024 13:30
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.

3 participants