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

feat(web): Organization published material, request-response matching #7161

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Apr 13, 2022

Organization published material, request-response matching

What

  • Matched what was searched with what got returned by comparing the hashed input with what the response gave us

Why

  • If the communication between the front- and backend suddenly lags then the UI on the page might be out of sync with what got returned so this change is to circumvent that

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

@RunarVestmann RunarVestmann added automerge Merge this PR as soon as all checks pass deploy-feature Deploys features to dev labels Apr 13, 2022
@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #7161 (d4ee586) into main (5e71d71) will increase coverage by 0.27%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7161      +/-   ##
==========================================
+ Coverage   27.08%   27.36%   +0.27%     
==========================================
  Files        3192     3157      -35     
  Lines       53962    53334     -628     
  Branches    13327    13116     -211     
==========================================
- Hits        14616    14595      -21     
+ Misses      39346    38739     -607     
Flag Coverage Δ
api 6.38% <ø> (ø)
application-system-api 69.60% <ø> (ø)
auth-admin-web 2.47% <ø> (ø)
cms-translations 37.50% <ø> (ø)
judicial-system-api 1.32% <ø> (ø)
judicial-system-backend 44.16% <ø> (+0.02%) ⬆️
services-user-notification 44.91% <ø> (ø)
web 5.60% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@github-actions
Copy link
Contributor

Affected services are: judicial-system-api,judicial-system-backend,application-system-api,api,services-user-notification,services-personal-representative-public,services-personal-representative,services-auth-public-api,air-discount-scheme-backend,financial-aid-api,services-auth-api,services-auth-admin-api,download-service,air-discount-scheme-api,services-search-indexer,financial-aid-backend,services-xroad-collector,icelandic-names-registry-backend,services-endorsements-api,services-user-profile,services-documents,judicial-system-xrd-api,reference-backend,skilavottord-ws,github-actions-cache,gjafakort-api,judicial-system-scheduler,gjafakort-application,gjafakort-queue-listener,financial-aid-web-veita,judicial-system-web,web,auth-admin-web,skilavottord-web,air-discount-scheme-web,gjafakort-web,financial-aid-web-osk,application-system-form,service-portal,island-ui-storybook,contentful-translation-extension,system-e2e,external-contracts-tests,
Feature deployment successful! Access your feature here:

https://organization-published-material-request-re-api-catalogue.dev01.devland.is/api
https://organization-published-material-request-re-api.dev01.devland.is/download
https://organization-published-material-request-re-application-payment-callback-xrd.internal.dev01.devland.is/application-payment
https://organization-published-material-request-re-application-payment-callback-xrd.internal.dev01.devland.is/applications
https://organization-published-material-request-re-beta.dev01.devland.is/
https://organization-published-material-request-re-beta.dev01.devland.is/api
https://organization-published-material-request-re-beta.dev01.devland.is/app/skilavottord/
https://organization-published-material-request-re-beta.dev01.devland.is/app/skilavottord/api/graphql
https://organization-published-material-request-re-beta.dev01.devland.is/minarsidur
https://organization-published-material-request-re-beta.dev01.devland.is/umsoknir
https://organization-published-material-request-re-cache.dev01.devland.is/
https://organization-published-material-request-re-contentful-translation-extension.dev01.devland.is/
https://organization-published-material-request-re-loftbru-cf.dev01.devland.is/
https://organization-published-material-request-re-loftbru-cf.dev01.devland.is/api/graphql
https://organization-published-material-request-re-loftbru-cf.dev01.devland.is/api/public
https://organization-published-material-request-re-loftbru-cf.dev01.devland.is/api/swagger
https://organization-published-material-request-re-loftbru.dev01.devland.is/
https://organization-published-material-request-re-loftbru.dev01.devland.is/api/graphql
https://organization-published-material-request-re-loftbru.dev01.devland.is/api/public
https://organization-published-material-request-re-loftbru.dev01.devland.is/api/swagger
https://organization-published-material-request-re-search-indexer-service.dev01.devland.is/
https://organization-published-material-request-re-service-portal-api.internal.dev01.devland.is/
https://organization-published-material-request-re-ui.dev01.devland.is/

@cypress
Copy link

cypress bot commented Apr 13, 2022



Test summary

1 0 0 0Flakiness 0


Run details

Project island.is
Status Passed
Commit 8bae5b5 ℹ️
Started Apr 19, 2022 2:46 PM
Ended Apr 19, 2022 2:57 PM
Duration 11:11 💡
OS Linux Ubuntu - 20.04
Browser Electron 91

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@RunarVestmann RunarVestmann marked this pull request as ready for review April 19, 2022 14:35
@RunarVestmann RunarVestmann requested review from a team as code owners April 19, 2022 14:35
@RunarVestmann RunarVestmann force-pushed the feature/organization-published-material-request-response-matching branch from 8952d13 to d4ee586 Compare April 19, 2022 14:41
Copy link
Contributor

@kristofer-lp8f kristofer-lp8f left a comment

Choose a reason for hiding this comment

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

A few questions:

  1. Is this a problem?
  2. Is it worth the extra complexity?
  3. Have you taken a look at debounce for delaying searching?
  4. Have you taken a look at invalidating previous HTTP requests?
  5. Have you considered relying on timestamps instead?

This seems like over-engineering for something I see not big a deal.

@RunarVestmann
Copy link
Member Author

RunarVestmann commented Apr 20, 2022

  1. We are trying to prevent this from being a possible problem (for example this was an issue for the Sýslumenn auctions where the data was not reflecting your search string since the backend wasn't answering at a consistant enough rate)
  2. It's not too much extra complexity since it's just one more string value to keep track of
  3. I am debouncing
  4. I don't see a simple way to do that since I'm using the useQuery hook
  5. I could use timestamps instead of hashing the input since all I really need is a simple comparison between requests and responses

@stefanhar
Copy link
Member

  1. We are trying to prevent this from being a possible problem (for example this was an issue for the Sýslumenn auctions where the data was not reflecting your search string since the backend wasn't answering at a consistant enough rate)
  2. It's not too much extra complexity since it's just one more string value to keep track of
  3. I am debouncing
  4. I don't see a simple way to do that since I'm using the useQuery hook
  5. I could use timestamps instead of hashing the input since all I really need is a simple comparison between requests and responses

I believe there is already handling for some race conditions within apollo client.
Might there be some other reason we are seeing a weird result here?
Does the issue persist if fetchPolicy is set to network-only?

@RunarVestmann
Copy link
Member Author

The implementation works fine without this change. This is just something a colleague pointed out and we added in case there is a halt in network communication. We could either just bail on this change and I'll close the PR or I could maybe do something a bit simpler like sending a timestamp instead of hashing the request. What do you guys think?

@kristofer-lp8f
Copy link
Contributor

If this is a real problem or will be in the foreseeable future, I'd prefer the timestamp version. If not, I vote to close this PR.

@RunarVestmann RunarVestmann deleted the feature/organization-published-material-request-response-matching branch April 22, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass deploy-feature Deploys features to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants