Resolve "Version dropdown goes wrong if versions are not monotonic"
What does this MR do?
Fixes bug raised in #13226 (closed).
Bug stemmed from the fact that, previously, the version id (obtained from the query param) was being compared to allVersions.length
, when instead it should be compared to currentVersionNumber
: version id could be anything, whereas `0 < currentVersionNumber < allVersions. See example scenario below.
Relevant tests have also been updated to reflect the new logic.
Additional changes:
- improved test coverage
- converted some methods to computed values to follow best practice
Example scenario where bug could have previously occurred
If we had an issue with 5 designs, with ID's [1
, 2
, 3
, 5
, 6
], and selected the 4th design (ID = 5
), then the UI would indicate it to be the latest design (because its ID happens to be the same as the number of designs we have). This is incorrect; the latest design is 6
.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
Edited by 🤖 GitLab Bot 🤖