fix(dashboard-list): change name of dashboard is not reflected instantly (#15186)

* fix: change name of dashboard is not reflected instantly

* fix: id

* fix: update info

* fix: add changed_on_delta_humanized
This commit is contained in:
Yaozong Liu 2021-07-09 11:28:33 +08:00 committed by GitHub
parent 2be52c0659
commit 1d572ca92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -157,8 +157,26 @@ function DashboardList(props: DashboardListProps) {
({ json = {} }) => {
setDashboards(
dashboards.map(dashboard => {
if (dashboard.id === json.id) {
return json.result;
if (dashboard.id === json?.result?.id) {
const {
changed_by_name,
changed_by_url,
changed_by,
dashboard_title = '',
slug = '',
json_metadata = '',
changed_on_delta_humanized,
} = json.result;
return {
...dashboard,
changed_by_name,
changed_by_url,
changed_by,
dashboard_title,
slug,
json_metadata,
changed_on_delta_humanized,
};
}
return dashboard;
}),