Skip to content

fix/AB#106122_ABC-resource-question-display-glitches #2713

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

Open
wants to merge 5 commits into
base: beta
Choose a base branch
from

Conversation

unai-reliefapp
Copy link
Contributor

Description

fix: initialize resource query on component mount, not on component open

Useful links

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Test A
  • Test B

Screenshots

Compartir.pantalla.-.2024-11-27.15_33_32.mp4

We now initialize resource query on component mount, not on dropdown open

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-frontend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

…resource query on component mount, not on component open
@unai-reliefapp unai-reliefapp added bug Something isn't working beta To be released on beta branch labels Nov 27, 2024
@unai-reliefapp unai-reliefapp self-assigned this Nov 27, 2024
Copy link

nx-cloud bot commented Nov 27, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit e36d100. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

…glitches # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
@AntoineRelief
Copy link
Collaborator

@unai-reliefapp

As shown in the video, you select the resource from the first page ( 10 first items of the query )
when you do that, the resource will automatically appear
but if the selected resource is part of the 2nd page or any other page from the resources query, the item won't appear, even with these changes

@AntoineRelief
Copy link
Collaborator

@unai-reliefapp
putting back in todo as I don't think it solves the issue

@AntoineRelief AntoineRelief marked this pull request as draft November 29, 2024 13:58
…end into fix/AB#106122_ABC-resource-question-display-glitches
…eful query subscription from the extended graphql component fix: update of values for outside of list elements in the resource dropdown for survey by always reassigning selected values from the list in the graphql component feat: improve the selectedResource property to avoid undefined trash values
@unai-reliefapp
Copy link
Contributor Author

@AntoineRelief , last commit
feat: remove unseful query subscription from the extended graphql component
fix: update of values for outside of list elements in the resource dropdown for survey by always reassigning selected values from the list in the graphql component
feat: improve the selectedResource property to avoid undefined trash values

Compartir.pantalla.-.2024-11-29.16_15_49.mp4

…f github.com-relief:ReliefApplications/ems-frontend into fix/AB#106122_ABC-resource-question-display-glitches
@unai-reliefapp unai-reliefapp marked this pull request as ready for review November 29, 2024 15:18
(node) => node[this.valueField] === selectedElement[this.valueField]
)
(this.isSurveyQuestion ||
!elements.find(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@unai-reliefapp
to be more generic, perhaps we should find another way to do it
I believe the issue is due to the fact that the selectedItem is not taken into consideration when you provide a new list of choices, and it's not only affecting the resource-dropdown component, but I got the feeling we've already managed to fix that in some of the instances of the graphql select component

from what I know, it's quicker to fetch the single selected resource than the first 10, and so it creates this error

I'll put back the ticket in todo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem was that the change detector ref was not working as expected due to the integration in the survey js and that we are using and extended component from graphql component. In the rest of the graphql instances in the application the default logic is working fine because of the change detector ref is working as expected. This way i make sure that on surveyjs the default logic to trigger the selected item outside the default fetche list is also added.

What do you have in mind for this then?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@unai-reliefapp
I can see a lot of change detector call in the stack, they don't work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No to this component level deepness, with surveyjs and an extended graphql component. That's why I used the isSurveyQuestion flag on this one to trigger the selected element insertion outside the default fetched list

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay, I'll have a look at it then
thanks for the explanation 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta To be released on beta branch bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants