Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Data is getting duplicated when modifying the content after importing data in a repeatable component #91

Closed
manikanta47052 opened this issue Jan 6, 2023 · 8 comments
Assignees

Comments

@manikanta47052
Copy link

Data is getting duplicated when modifying the content after importing data in a repeatable component

To Reproduce
Steps to reproduce the behavior:

  1. I have a repeatable component with two fields label and url, I created a single collection type 'Test' with two of these repeatable component like below.
    image
  2. I have two different workspaces with same content type Test. One workspace is for exporting content and another workspace for importing the content file
  3. After adding content in 1st workspace and exporting it.
    Importing the exported content file in a 2nd workspace with same Test content type and it is getting successfully saved

image

  1. After refreshing the page and trying to modifying or adding new data to the imported content
    image

  2. After clicking save the data is getting duplicated like below and also not able to delete duplicated content
    image

Expected behavior
After modifying the imported content, The content should not be duplicated in repeatable component

Additional context
I tried to use strapi unique field option but there is a bug in strapi that is not letting me add new data even though content is unique

Im new to this. Let me know if there is anything im missing.
Really appreciate your work, this plugin is very useful. Thanks in advance.

@manikanta47052 manikanta47052 changed the title [BUG] [BUG] Data is getting duplicated when modifying the content after importing data in a repeatable component Jan 9, 2023
@LiquidITGuy
Copy link

We have the same behaviour here.
putting a flag on this topic.

@meganoob1337
Copy link

I have had this problem aswell,
My workaround is now:
Import your Data (i used it to migrate from another system and generate the import files and add the assets as the upload is nice)
then use the new Feature in strapi v4.6.0 and export your content with yarn strapi export
then reset the DB
then import your exported data with yarn strapi import -f
Now i dont have the problem with duplication anymore (I have no clue why, but im happy - took me forever to migrate everything into the json format for importexport entries plugin )
Hope this helps and works for you as well :) @manikanta47052 @LiquidITGuy

@tcherokee
Copy link

Same here. Going to try @meganoob1337 solution....

@anujkohli
Copy link

I am facing the same issue, can this be fixed please?

mitenka added a commit to mitenka/strapi-plugin-import-export-entries that referenced this issue Mar 2, 2023
mitenka added a commit to mitenka/strapi-plugin-import-export-entries that referenced this issue Mar 2, 2023
mitenka added a commit to mitenka/strapi-plugin-import-export-entries that referenced this issue Mar 2, 2023
@mitenka
Copy link
Contributor

mitenka commented Mar 2, 2023

It looks like issue #81 has similar nature. And I hope that PR #97 fixes it. It's not covered with tests tho, feel free to propose improvements and share if it works for you

@Kyle772
Copy link

Kyle772 commented Apr 3, 2023

https://discord.com/channels/1021121498276171786/1021121949537153145/1049829680573849661

A user on the discord channel has figured out a work around until this is fixed

Here are the steps:

  1. Run an import
  2. Query through the db with pgadmin or another db management tool
  3. Anything that ends in "_components" is a culprit
  4. Look for component_type === null
  5. Grab the value from the attributes."attribute_name".component key in each of your strapi schemas
  6. do a bulk update on all component_types that are null and set it to the value from step 5
    6.5) If you run into errors on placing values it's due to you already having duplicate entries in your db, I was safely able to just delete the duplicates (since the data is in the component_type null entries already). If you rerun a fresh import this can be avoided.
  7. repeat through all "_component" tables
  8. Backup your db once you've done them all so you have a checkpoint.

This took me about ~10 minutes to do on a pretty big strapi project.

@mitenka
Copy link
Contributor

mitenka commented Apr 11, 2023

Awesome! In case somebody is looking for a SQL query that might be helpful for the case described by @Kyle772, it's here, #81 (comment)

Baboo7 pushed a commit to mitenka/strapi-plugin-import-export-entries that referenced this issue Apr 22, 2023
Baboo7 pushed a commit to mitenka/strapi-plugin-import-export-entries that referenced this issue Apr 22, 2023
@Baboo7 Baboo7 closed this as completed in 87fb93d Apr 22, 2023
@Baboo7
Copy link
Owner

Baboo7 commented Apr 23, 2023

Thank you for this detailed report folks! Checkout version 1.19.0 that fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants