Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Save as Copy don't work as expected #13426

Closed
younky-yang opened this issue May 20, 2022 · 0 comments
Closed

Save as Copy don't work as expected #13426

younky-yang opened this issue May 20, 2022 · 0 comments

Comments

@younky-yang
Copy link

Describe the Bug

Save as Copy function actually can save a lots of effort for user if they have item has many attributes and can be shared or just need to some subtle changes. But the current implementation of Save as Copy may not work as expected.

  1. when you create a new item, you can activate the Save as Copy function, but it doesn't work.
  2. When you edit an item (without M2O or M2M relations), when you click Save as Copy, the edit information is gone, it just save the copy of original records. This should be the right one but from UI it should not be triggered after you made some changes.
  3. When you edit an item with M2O or M2M relations, the progress circle just spin for ever as it throws exception in SaveAsCopy().

I tried to analyze the source codes saveAsCopy() in app/src/composibles/use-item/use-item.ts, and have some thoughts on below.

  1. We give an popup menu options for item in list page, which user can just select Save As Copy without entering the detail page, with this approach, user will not be confused on the edit content lost, so it just save a copy of the selected item as new one
  2. In the implementation of saveAsCopy(), we call an post API to just create a new copy of the selected item based on the PK, and handle all these relations in backend and then returns the new created copy item.
  3. Update the list page of collections with the new created copy item.

To Reproduce

create 2 collection and set some M2M relations, then edit one item in a collection, then trigger Save As Copy, you will get the progress circle spinning forever.

Update any collection item without M2M(M2O) collection, edit some content and then trigger Save As Copy, then you lost all the edits you made

Errors Shown

The progress circle spinning forever without a message popup. or you just lost the edits you made for an item.

What version of Directus are you using?

9.10

What version of Node.js are you using?

16.15.0

What database are you using?

postgres 14

What browser are you using?

chrome

How are you deploying Directus?

local test and AWS ECS

@younky-yang younky-yang changed the title Save as Copy just don't work as expected Save as Copy don't work as expected May 20, 2022
@directus directus locked and limited conversation to collaborators May 20, 2022
@azrikahar azrikahar converted this issue into discussion #13428 May 20, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant