-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix coverage data saving/rendering from embed plan #2143
Fix coverage data saving/rendering from embed plan #2143
Conversation
client/api/events.ts
Outdated
@@ -176,7 +176,7 @@ function create(updates: Partial<IEventItem>): Promise<Array<IEventItem>> { | |||
function update(original: IEventItem, updates: Partial<IEventItem>): Promise<Array<IEventItem>> { | |||
return superdeskApi.dataApi.patch<IEventItem>('events', original, { | |||
...updates, | |||
associated_plannings: undefined, | |||
associated_plannings: updates.associated_plannings, |
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.
@MarkLark86 this is the fix I found to be working so we persist the changes, and send the proper data back in the UI.
This is a follow up PR based on these comments - https://sourcefabric.slack.com/archives/C06HDLLA1SP/p1733139297225319
Let me know if that's how things should work, from my side there's no issues I see in the UI, and the changes do work.
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.
All other changes are just improvements, this is the actual change that's fixing the issues mentioned in the linked tickets
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.
Hey @thecalcc
associated_plannings
is set to undefined
because we don't want to store this on the Event item itself (this happens for both create and update actions).
Instead what I would try is to re-populate this field after the response from the server/update action:
superdesk-planning/client/api/events.ts
Lines 199 to 202 in f690905
.then((response) => { | |
const events = modifySaveResponseForClient(response); | |
return planningApi.planning.searchGetAll({ |
.then((response) => {
const events = modifySaveResponseForClient(response);
events[0].associated_plannings = updates.associated_plannings
return planningApi.planning.searchGetAll({
Can you please try that and see if that fixes the issue
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.
Ok makes sense, just tried that and it does work
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.
Looks fine
SDCP-863
SDCP-875
Front-end checklist
memo
orPureComponent
to define new React components (and updates existing usages in modified code segments)lodash.get
with optional chaining and nullish coalescing for modified code segmentssuperdeskApi
)superdesk-ui-framework
andsuperdeskApi
when possible instead of using ones defined in this repository.planningApi
where it is possible to usesuperdeskApi
planningApi
)