-
Notifications
You must be signed in to change notification settings - Fork 3
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
UIMARCAUTH-438 Do not load MARC source until consortia data is available. #428
Conversation
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.
Code changes LGTM; consider clearer names for functions and additional documentation.
@@ -26,6 +26,22 @@ import { | |||
|
|||
import { AuthorityView } from '../../views'; | |||
|
|||
const checkCanLoadMarcSource = (isConsortiaEnv, isShared, isConsortiumDataLoaded, isAuthorityLoaded) => { |
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.
It returns a boolean; just call it canLoadMarcSource
. Functions named checkFoo
or validateFoo
should return null/undefined on success and throw an error on failure. Functions named like isValidFoo
or canLoadFoo
should return true
on success and false
on failure.
Consider adding the description from the PR as a header comment for this function to answer why these are the relevant conditions to evaluate when deciding if it is possible to load MARC source.
const marcSource = useMarcSource({ recordId: id, tenantId, enabled: Boolean(selectedAuthority) }, { | ||
|
||
const isConsortiaEnv = stripes.hasInterface('consortium'); | ||
const isShared = selectedAuthority?.shared; |
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.
Consider !!(selectedAuthority?.shared)
or Boolean(selectedAuthority?.shared)
to convert the undefined
value returned by optional chaining to boolean false. Related, selectedAuthority.shared
should really be ...isShared
, but I don't know if you're in charge of that property.
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.
If you mean selectedAuthority.isShared
then we can't do it because this property comes from a BE response
Quality Gate passedIssues Measures |
…ble. (#428) * UIMARCAUTH-438 Do not load MARC source until consortia data is available. * UIMARCAUTH-438 added comments to a new function
Description
Do not load MARC source until consortia data is available.
The issue was caused by a delay when loading consortia data. If an authority record is loaded before consortia data is available then we fetch MARC source from a member tenant, which is incorrect for shared records
Screenshots
chrome_rBhys1sGq4.mp4
Issues
UIMARCAUTH-438