-
Notifications
You must be signed in to change notification settings - Fork 8
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
Availability bug #1348
Availability bug #1348
Conversation
0a363ab
to
56ab856
Compare
56ab856
to
4b4fa49
Compare
Two major factors to be aware of here: * Three hooks are introduced instead of one: One main hook and one for physical and one for online materials, to get a better overview of the rules and the logic. * Apparently we cannot make use of `onSuccess` handlers on queries if the request have alredy been performed and the data is delivered the second time by the `QueryClient` cache. And that is the case of the availability labels on a material page, where they are used both in the header and in the "udagver" section later on the page.
4b4fa49
to
4280787
Compare
5d6484e
to
56fc307
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two comments that I think you should consider before moving on with this :)
Otherwise I can't see any more potential problems :) Fingers crossed that it all works as they intended, since DDF has soooo much business logic in regard to availability 🤯
Luckily, someone from DDF (probably Tue) will be reviewing this too.
src/components/availability-label/usePhysicalAvailabilityData.ts
Outdated
Show resolved
Hide resolved
b4c7275
to
f49c496
Compare
f49c496
to
9ed98b6
Compare
Since we have multiple article types we should consider those in the various places where we have functionality relying on those types.
9ed98b6
to
db378df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it ❤️
Link to issue
https://reload.atlassian.net/browse/DDFLSBP-722
Description
The main problem was that because the availability hook can be run twice with the same parameters eg on the material page where the availability labels are presented. The former version of
useAvailabilityData
could not handle that scenario.physical and one for online materials, to get a better overview of
the rules and the logic.
onSuccess
handlers on queries ifthe request have alredy been performed and the data is delivered the
second time by the
QueryClient
cache. And that is the case of theavailability labels on a material page, where they are used both in the
header and in the "udgaver" section later on the page.