notum-cz/strapi-plugin-content-versioning

[Fix found] Unable to change version

Closed this issue · 3 comments

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

  1. Go to a content type
  2. Create a new version
  3. Try to change version
  4. See error

Expected behavior

The version changes as expected

Screenshots

image
image

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

Submitted PR #90 for issue fix

Hi @harrycarp, thank you for the PR. I've requested a minor change so could you please take a look?

Merged in #90