-
Notifications
You must be signed in to change notification settings - Fork 18
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
UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record #2416
Conversation
…letes a shared record
…letes a shared record
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 a few questions:
- Rather than directly calling
fetch()
, what about wrapping ViewInstance withwithOkapiKy
and passingokapiKy
tosetRecordForDeletion()
? That will let you avoid a lot of the boilerplate of x-okapi-this and x-okapi-that. ** - What's the value of wrapping the fetch in try/catch and throwing given you just catch and return the error? If you want to return the
Error
, just return it. Feels like a weird pattern though, since it doesn't alert the calling function that anything has gone wrong unless it inspects the type of the returned value, which it doesn't.
** OK, it's not quite that easy since we missed updating withOkapiKy
in folio-org/stripes-core#1348 / STCOR-747 when you added the tenant
prop to useOkapiKy
. We should add it now so withOkapiKy
and useOkapiKy
have parity, agreed?
Hi @zburke |
@OleksandrHladchenko1 add handling of an error, please. Show unsuccessful toast for the case when the request failed or any error occurred |
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.
This is different but I'm not sure it's better. The calling code does fx().then().catch()
. Previously, your fx()
implementation included try/catch, but caught and returned the error, so the parent catch
block would never be invoked. Now you removed the try/catch, but also removed its throw
, so again the parent catch
block will never be invoked.
Am I misunderstanding something here? IIUC, the bug report identified a 404 that was causing an error toast. Sending the correct (central) x-okapi-tenant in the request header fixes the 404 (good!) ... but I think we should keep the error-handling in place in case of some other problem with the request. Agreed?
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.
These changes LGTM now. @mariia-aloshyna , do you agree that we have resolved both problems?
- correctly set the central tenant id in the request
- continue to provide error handling in case the request fails
Quality Gate passedIssues Measures |
…letes a shared record (#2416) * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * Update utils.test.js * UIIN-2784: Throw error in catch block * UIIN-2784: Remove try catch * UIIN-2784: Throw exception if response is failed * UIIN-2784: Fix tests (cherry picked from commit 0ca01a0)
* UIIN-2802 Retain browse query when switching Inventory browse options (#2417) * UIIN-2802 Keep query when changing Browse options * UIIN-2802 Update changelog * UIIN-2802 Remove unneeded mock code * UIIN-2802 Update changelog (cherry picked from commit 1477513) * UIIN-2802 Set prevSearchIndex when perfoming Browse, not when changing option (#2424) (cherry picked from commit fdbf09e) * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record (#2416) * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * UIIN-2784: Set central tenant id in the request when Member tenant deletes a shared record * Update utils.test.js * UIIN-2784: Throw error in catch block * UIIN-2784: Remove try catch * UIIN-2784: Throw exception if response is failed * UIIN-2784: Fix tests (cherry picked from commit 0ca01a0) * UIIN-2814 Apply staffSuppress.false in Holdings/Items search (#2420) * UIIN-2814 Fix staff suppress false not applied for first holdings/items search * UIIN-2814 Update changelog * UIIN-2814 fix issue with crash when filters are empty * UIIN-2814 Added tests for holdings staff suppress * UIIN-2814 Fix tests (cherry picked from commit 144db41) * UIIN-2814 Clear USER_TOUCHED_STAFF_SUPPRESS_STORAGE_KEY flag when switching between search segments (follow-up) (#2435) * UIIN-2814 Clear USER_TOUCHED_STAFF_SUPPRESS_STORAGE_KEY flag when switching between search segments * UIIN-2814 fix eslint (cherry picked from commit 4512f51) * UIIN-2815: Pass tenantId when open holding details during moving holdings/items (#2427) (cherry picked from commit cf33184) * UIIN-2780: ECS - Member consortial accordion is not displaying when user have according affiliation but don't have permissions for view holdings (#2429) (cherry picked from commit 7e785df) * Release v11.0.1 --------- Co-authored-by: Denys Bohdan <[email protected]> Co-authored-by: Oleksandr Hladchenko <[email protected]>
Purpose
Approach
setRecordForDeletion
which performs setting record for deletion using dynamically passedtenantId
Refs
UIIN-2784
Screenshots
UIIN-2784.mp4