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

[Publisher] Fix "Other" checking and unchecking behavior in Metric Settings #1639

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

Conversation

nasaownsky
Copy link
Collaborator

Description of the change

Fixed "Other" checking and unchecking behavior in Metric Settings page

Type of change

All pull requests must have at least one of the following labels applied (otherwise the PR will fail):

Label Description
Type: Bug non-breaking change that fixes an issue
Type: Feature non-breaking change that adds functionality
Type: Breaking Change fix or feature that would cause existing functionality to not work as expected
Type: Non-breaking refactor change addresses some tech debt item or prepares for a later change, but does not change functionality
Type: Configuration Change adjusts configuration to achieve some end related to functionality, development, performance, or security
Type: Dependency Upgrade upgrades a project dependency - these changes are not included in release notes

Related issues

closes #1621

Checklists

Development

This box MUST be checked by the submitter prior to merging:

  • Double- and triple-checked that there is no Personally Identifiable Information (PII) being mistakenly added in this pull request

These boxes should be checked by the submitter prior to merging:

  • Tests have been written to cover the code changed/added as part of this pull request

Code review

These boxes should be checked by reviewers prior to merging:

  • This pull request has a descriptive title and information useful to a reviewer
  • This pull request has been moved out of a Draft state, has no "Work In Progress" label, and has assigned reviewers
  • Potential security implications or infrastructural changes have been considered, if relevant

@nasaownsky
Copy link
Collaborator Author

Hi @mxosman! Please test this changes and see if my fix solved the problem for you! I tried many different approaches, but it seems like only this particular solution is fixing it for me.

Note: there could be already checked "other" dimensions (before this update) -- in that case they'll be checked without description since there is no way for FE to uncheck them from BE passively. I think this explains why "other" dimension is checked in the start of the second video from the task description (Prisons II agency).

@nasaownsky
Copy link
Collaborator Author

The thing I don't like about this solution is that the "Settings saved" toast popups twice when we hit "Save" button. After thinking some more about this and trying to find another solutions this is the only one that 100% solves the bug for me.

@mxosman
Copy link
Contributor

mxosman commented Jan 17, 2025

Hi @nasaownsky - digging into it this now.

there could be already checked "other" dimensions

That makes sense - I'm OK with the behavior there.

The thing I don't like about this solution is that the "Settings saved" toast popups twice when we hit "Save" button

Hmm, yeah - I'm not a fan of that b/c that means it's sending two requests each time. Any idea why it's sending two requests?

Also separately, but potentially related - one thing I'm noticing too is that clicking the X button to close a modal sends a request, which might be contributing to some strange behavior. Do you know why that's happening? I thought the close modal code just updated local state.

@mxosman
Copy link
Contributor

mxosman commented Jan 17, 2025

Also separately, but potentially related - one thing I'm noticing too is that clicking the X button to close a modal sends a request, which might be contributing to some strange behavior. Do you know why that's happening? I thought the close modal code just updated local state.

Ah - I see you already addressed this.

@@ -567,7 +566,8 @@ function DefinitionModalForm({
{!isReadOnly && !hasNoSettingsAndNoContext && (
<Button
label="Save"
onClick={() => {
onClick={async () => {
await handleOtherDimensionUpdate();
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, we're calling saveMetricSettings twice with these two methods... What's the motivation behind awaiting this? Is there no way to consolidate these two save methods to avoid two redundant requests and still solve the issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the handleSaveSettings - I see we're referencing and looping through the currentSettings object - could we update that local state when folks update the Other Dimension so it's picked up by the saveMetricSettings in the handleSaveSettings function?

Oi - the DefinitionModalForm file is quite convoluted - thanks for swimming in this...

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

Successfully merging this pull request may close these issues.

[Bug] Metric Settings: "Other" checking and unchecking behavior not working consistently
2 participants