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

Custom Dashboard Filters Display breaking for Gender #1107

Closed
AchalaBelokar opened this issue Sep 26, 2023 · 6 comments
Closed

Custom Dashboard Filters Display breaking for Gender #1107

AchalaBelokar opened this issue Sep 26, 2023 · 6 comments
Assignees
Labels

Comments

@AchalaBelokar
Copy link

Describe the bug
Filter is not working properly
we need to apply filter by gender

To Reproduce
Steps to reproduce the behavior:

  1. login with AchalaB@sakhiapp
  2. Click on on filter
  3. select any gender male female
  4. apply filter

Expected behavior
which filter is applying should be shown clearly
Screenshots

filter work

@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Sep 26, 2023
@mahalakshme mahalakshme moved this from New Issues to In Analysis Review in Avni Product Sep 26, 2023
@mahalakshme
Copy link
Contributor

In circle-ci we are calling deploy_platform_translations_prerelease, so need to dig more

@mahalakshme mahalakshme moved this from In Analysis Review to Ready in Avni Product Sep 26, 2023
@mahalakshme mahalakshme removed the 5.0.0 label Sep 26, 2023
@mahalakshme mahalakshme changed the title Filter is not working properly Translations for filters missing Sep 26, 2023
@ashusvnath
Copy link

This behaviour is seen in the 4.0 APK also.

@ashusvnath ashusvnath self-assigned this Sep 26, 2023
@ashusvnath ashusvnath moved this from Ready to In Progress in Avni Product Sep 26, 2023
@mahalakshme
Copy link
Contributor

but still we need to fix this issue

@ashusvnath
Copy link

params::: [{"type":"Gender","dataType":null,"filterValue":[{"that":{}},{"that":{}},{"that":{}},{"that":{}}]}]

@ashusvnath
Copy link

The problem is not with translations but the way @ungap/structured-clone is serializing and saving filters in the Realm DB's CustomDashboardCache.
The above seen value is result of deserialzing the filters from the fast synced realm db's CustomDashboardCache

1t5j0y added a commit to avniproject/avni-models that referenced this issue Sep 27, 2023
…lization of custom dashboard cache elements
@1t5j0y 1t5j0y changed the title Translations for filters missing Custom Dashboard Filters breaking for Gender Sep 27, 2023
@1t5j0y 1t5j0y changed the title Custom Dashboard Filters breaking for Gender Custom Dashboard Filters Display breaking for Gender Sep 27, 2023
@1t5j0y 1t5j0y self-assigned this Sep 28, 2023
1t5j0y added a commit to avniproject/avni-models that referenced this issue Sep 28, 2023
…lization of selectedValues in CustomDashboardCache

Removed @ungap/structured-clone as a dependency
1t5j0y added a commit that referenced this issue Sep 28, 2023
…shboardCache fields

Removed @ungap/structured-clone as a dependency.
Added General.deepOmit function to remove specific key(s) in a nested object. Helps prevent cyclic reference errors during JSON.stringify.
@1t5j0y 1t5j0y moved this from In Progress to Code Review Ready in Avni Product Sep 28, 2023
@1t5j0y
Copy link
Contributor

1t5j0y commented Sep 28, 2023

Use of structured-clone was causing changes during serialization/deserialization and conversion of the deserialized value to state which was causing the observed issue. Also, the JSON columns in CustomDashboardCache were no longer readable JSONs with the change to use this library.

Made changes to rely on JSON.stringify and remove the use of structured-clone for serialization of CustomDashboardCache fields. All fields except selectedValues worked immediately. selectedValues caused a problem when Address type filters were used and multiple locations were selected (due to locations containing locationMappings which caused cyclic reference issues). Removed locationMappings from the object used in the filters on the CustomDashboard screens and this issue went away.

During testing, noticed filterConfig with value '0' as uuid which was causing run time errors due to methods being called on an undefined object. Not sure if this was due to the use of structured-clone and if such cases exist in prod but added some additional code to handle this scenario to fail gracefully and not crash.

@petmongrels petmongrels moved this from Code Review Ready to In Code Review in Avni Product Sep 29, 2023
@petmongrels petmongrels moved this from In Code Review to QA Ready in Avni Product Sep 29, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Sep 29, 2023
@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

5 participants