Energinet-DataHub / greenforce-frontend

GreenForce monorepo for the DataHub and Energy Origin frontends. Part of Energinet DataHub.
Apache License 2.0
74 stars 14 forks source link

feat(dh): set merge type policy for Organization type #3494

Closed dzhavat closed 1 month ago

dzhavat commented 2 months ago

Description

Important: The changes made to "dh-graphql.providers.ts" were reverted in #3496 because we decided to fix the issue differently. Check the linked PR for more info.


DataHub

The Organization type policy fixes an issue with user invitation where after taking some user actions in a specific order, the Organization object resulted in a missing property because of how GraphQL merged two queries.

The user actions are:

  1. Navigate to users overview
  2. Start the user invite flow
  3. Select an actor from the dropdown (anyone but DataHub)
  4. Input an email that does NOT exist as part of the selected actor (it must match with the actor's domain)
  5. Verify that the "Information" tab is shown
  6. Leave the user invite flow
  7. Click on a user that is already invited to the actor selected in step 3
  8. Close the user details drawer
  9. Start the invite flow
  10. Select the same actor from step 3
  11. Input the same non-existing email from step 4
  12. Verify that the "Information" tab is NOT shown

The reason for this was that two queries containing the "Organization" object were executed during those steps. In the first one (step 3), the "Organization" had a domain property among others, whereas in the second one (step 7), the "Organization" did NOT have the domain property.

Before the changes in this PR, the domain property was overwritten with the data from the "Organization" property in the second query.

Now, GraphQL should merge the "Organization" data coming from different queries.

References

nx-cloud[bot] commented 2 months ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b1485d8c18ec60cd805bf61e2566b8b71ebba231. 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 2 targets - [`nx run api-dh:build-client`](https://cloud.nx.app/runs/vFsndWwFjf?utm_source=pull-request&utm_medium=comment) - [`nx build app-dh`](https://cloud.nx.app/runs/v3osfZpSzK?utm_source=pull-request&utm_medium=comment)

Sent with πŸ’Œ from NxCloud.