strapi-plugin-content-versioning icon indicating copy to clipboard operation
strapi-plugin-content-versioning copied to clipboard

Articles disappearing and database anomalies after upgrading

Open DaDlugosch opened this issue 2 years ago • 10 comments

Bug report

Describe the bug

Upon upgrading from version 0.4.7 to 0.4.9 (or 0.4.8), an issue arose where newly created articles, when published, caused the previous article to disappear from the table view and revert to an unpublished state. Additionally, there were anomalous changes observed in the database, with the publish date value being altered to null, and the value for is_visible_in_list_view changing from 1 to 0. However, it is noteworthy that the latest created article displayed correctly. Subsequent attempts to create new articles resulted in a recurrence of the same scenario, as evidenced by the screenshot wherein the latest article possesses the value 1 for the is_visible_in_list_view property, whereas others are assigned 0.

At first, I reported a bug in the strapi-plugin-publisher repository, assuming that the publisher plugin was responsible for the mentioned issue. However, upon further investigation, it became clear that the problem is in your plugin. Original issue can be still found here: https://github.com/ComfortablyCoding/strapi-plugin-publisher/issues/86.

Expected behavior

When I create and publish new articles, the previous persist in the table view, still are published (or in the same state as they were).

Screenshots

image

Code snippets

I'm attaching all of my node dependencies presented in the package.json file. I have no other strapi modifications.

{
  "devDependencies": {},
  "dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.0.4",
    "@ef2/strapi-plugin-bold-title-editor": "1.0.8",
    "@notum-cz/strapi-plugin-content-versioning": "0.4.7",
    "@strapi/plugin-graphql": "4.11.7",
    "@strapi/plugin-i18n": "4.11.7",
    "@strapi/plugin-seo": "^1.9.2",
    "@strapi/plugin-users-permissions": "4.11.7",
    "@strapi/strapi": "4.11.7",
    "mysql": "2.18.1",
    "patch-package": "^7.0.2",
    "strapi-plugin-duplicate-button": "^1.1.12",
    "strapi-plugin-navigation": "^2.2.11",
    "strapi-plugin-publisher": "^1.3.7",
    "strapi-plugin-sitemap": "^3.0.3",
    "strapi-plugin-stellate": "^0.0.5"
  }
}

System

  • Node.js version: v16.18.1 (also tried with v18.16.1, cause finally, after upgrading version of this plugin, build works)
  • NPM version: 8.19.2
  • Strapi version: 4.11.7
  • Database: MariaDB 10.6.12
  • Operating system: Ubuntu 22.04

DaDlugosch avatar Jul 24 '23 10:07 DaDlugosch

Hi @DaDlugosch, changing is_visible_in_list view from 1 to 0 is a wanted behaviour as we do not want all versions of the same content to be shown in the list view. Also only one version of the content can be published at a time so altering the published_at for other non-published versions is correct.

However, the problem I see in the screenshot that you provided is that vuuid is not set and it should be. We have recently updated the uuid dependency in #102 so it might have caused some problems. I will examine it and get back to you.

omikulcik avatar Jul 25 '23 07:07 omikulcik

Hey @DaDlugosch, I've just tested with your setup (the only difference is that I am on MacOS but that should not be a problem) and everything works fine. As I mentioned in the previous comment, the behaviour is correct and my only concern was that you have vuiid = null in your DB. That does not happen to me. image

omikulcik avatar Jul 26 '23 07:07 omikulcik

@omikulcik I was using it with the strapi-plugin-publisher plugin. Before the upgrade, when I published an article with the date in the past, it was published with that date and the date was set up in the database. After your plugin upgrade, the date was removed from the database after each publication in the past, and is_visible_in_list_view was set to 0 instead of 1, which is bug for me, because I didn't have any other versions. Only that one was intended to be published.

DaDlugosch avatar Jul 26 '23 08:07 DaDlugosch

It seems to me that both plugins are now manipulating the same property in the DB and thus to me it is not really a bug but an incompatibility. Sorry, we unfortunately can't guarantee compatibility with other plugins.

omikulcik avatar Aug 01 '23 09:08 omikulcik

I'm experiencing the same issue and I have not installed any other plugins.

This is the list of steps:

  1. docker run -it -p 13377:1337 node:16 /bin/bash

  2. npx create-strapi-app@latest my-project --quickstart

  3. npm install --save @notum-cz/strapi-plugin-content-versioning

  4. Update config/plugins.js

  5. npm run build

  6. npm run develop

  7. Create new collection type with small text field, long text field and number

  8. Create first entry, save and publish. I can see the entry in the list.

  9. Create second entry, save and publish

  10. I can see the second entry in the list but first entry is not showing any more

image

It works fine if the collection type does not have "Enable versioning for this Content-Type" checked.

Here is my package.json

{
  "name": "my-project",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@notum-cz/strapi-plugin-content-versioning": "^0.4.10",
    "@strapi/plugin-i18n": "4.12.1",
    "@strapi/plugin-users-permissions": "4.12.1",
    "@strapi/strapi": "4.12.1",
    "better-sqlite3": "8.5.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "e1162a5d-59b8-4d24-82e0-172ad3ec7bf3"
  },
  "engines": {
    "node": ">=16.0.0 <=20.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

lrodrigo-cluey avatar Aug 04 '23 00:08 lrodrigo-cluey

Hi @lrodrigo-cluey, this is correct behaviour. In the list you should only see the latest/published version of your content. Other versions are hidden and can be seen in the dropdown in which you select a specific version.

omikulcik avatar Aug 07 '23 12:08 omikulcik

Hey @omikulcik , the problem was that unrelated entries were hidden (not v1, and v2, just some other entry). But I realized it was my mistake, I was using Strapi "Save" button to save the first entry, and then the plug-in "Save" button to save new versions.

If anyone is having a similar issue, I solved it by applying patches:

  • @notum-cz+strapi-plugin-content-versioning+0.4.10.patch (https://github.com/notum-cz/strapi-plugin-content-versioning/issues/75)
  • @strapi+admin+4.12.0.patch

lrodrigo-cluey avatar Aug 08 '23 04:08 lrodrigo-cluey

Same here, we have to temporarily disable this plugin. We just upgraded to the latest version, and boom, all the new articles disappeared.

Novaera avatar Sep 18 '23 18:09 Novaera

@Novaera Have you applied the patch?

omikulcik avatar Sep 20 '23 07:09 omikulcik

Hi guys, we have just published a new version that removes the need to patch strapi admin and works and uses entity service decorator. Can you please test whether this problem still persists in this newer version?

omikulcik avatar Sep 25 '23 07:09 omikulcik