Skip to content

Commit

Permalink
Fix bug where some values in project list were displayed incorrectly (#…
Browse files Browse the repository at this point in the history
…5339)

* Fix bug where some values in project list were displayed incorrectly

* CHANGELOG.unreleased.md
  • Loading branch information
fm3 authored Mar 25, 2021
1 parent e98f84f commit f0cceb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
[Commits](https://github.com/scalableminds/webknossos/compare/21.04.0...HEAD)

### Added
-
-

### Changed
- webKnossos is now part of the [image.sc support community](https://forum.image.sc/tag/webknossos). [#5332](https://github.com/scalableminds/webknossos/pull/5332)
- Meshes that are imported by the user in the meshes tab are now rendered the same way as generated isosurface meshes. [#5326](https://github.com/scalableminds/webknossos/pull/5326)

### Fixed
-
- Fixed a bug where some values in the project list were displayed incorrectly after pausing/unpausing the project. [#5339](https://github.com/scalableminds/webknossos/pull/5339)

### Removed
-
Expand Down
15 changes: 12 additions & 3 deletions frontend/javascripts/admin/project/project_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as React from "react";
import _ from "lodash";

import { AsyncLink } from "components/async_clickables";
import type { APIProjectWithAssignments, APIUser } from "types/api_flow_types";
import type { APIProjectWithAssignments, APIProject, APIUser } from "types/api_flow_types";
import type { OxalisState } from "oxalis/store";
import { enforceActiveUser } from "oxalis/model/accessors/user_accessor";
import {
Expand Down Expand Up @@ -141,13 +141,22 @@ class ProjectListView extends React.PureComponent<PropsWithRouter, State> {
});
};

mergeProjectWithUpdated = (
oldProject: APIProjectWithAssignments,
updatedProject: APIProject,
): APIProjectWithAssignments =>
// $FlowIgnore[prop-missing] flow does not understand that merging with type that is superset should produce that type.
({ ...oldProject, ...updatedProject });

pauseResumeProject = async (
project: APIProjectWithAssignments,
APICall: string => Promise<APIProjectWithAssignments>,
APICall: string => Promise<APIProject>,
) => {
const updatedProject = await APICall(project.name);
this.setState(prevState => ({
projects: prevState.projects.map(p => (p.id === project.id ? updatedProject : p)),
projects: prevState.projects.map(p =>
p.id === project.id ? this.mergeProjectWithUpdated(p, updatedProject) : p,
),
}));
};

Expand Down

0 comments on commit f0cceb7

Please sign in to comment.