[Fix found] Unable to change version
Closed this issue · 3 comments
harrycarp commented
Bug report
Describe the bug
When changing the Version of the content you are viewing, the switch fails because the version can not be found.
Errors with Uncaught TypeError: it is undefined
, from webpack source referencing /content-manager/collectionType/${gt}/${it.id}
Steps to reproduce the behavior
- Go to a content type
- Create a new version
- Try to change version
- See error
Expected behavior
The version changes as expected
Screenshots
Code snippets
I've developed a patch to fix the issue by normalising the type checking in the find() function for the selected version in the handleChange callback function.
// fixed bug when version being iterated was not the same type as the version being selected (string != number)
const selectedVersion = data.find((v) => v.versionNumber === +value);
System
- Node.js version: v16.20.0
- NPM version: 8.19.4
- Strapi version: 4.11.1
- Database: sqlite
- Operating system: Windows 10
Additional context
I've already developed a fix, just want to submit a merge request
omikulcik commented
Hi @harrycarp, thank you for the PR. I've requested a minor change so could you please take a look?