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

feat: implement duplicate row functionality #930

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

AliceLanniste
Copy link
Contributor

close #796

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 10951572039

Details

  • 25 of 25 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on duplicate_row_new at 85.088%

Totals Coverage Status
Change from base Build 10943358602: 85.1%
Covered Lines: 36177
Relevant Lines: 42517

💛 - Coveralls

@caoxing9
Copy link
Contributor

Oops, conflict leading to new feature(comment), fortunately it is easy to resolve, i'll review it.

@AliceLanniste
Copy link
Contributor Author

> Hi, I've been waiting too long for the merge pr.

Oops, conflict leading to new feature(comment), fortunately it is easy to resolve, i'll review it.
Hi, I've been waiting too long for the merge this pr. when to merge this pr?

Copy link
Contributor

@boris-w boris-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also the fact that it's currently duplicate a single line, but the interface definition and endpoint return type appear to be multiple lines

Comment on lines +76 to +84
const onDuplicate = async (tableId: string, recordId: string) => {
await duplicateRecords(tableId, recordId, {
viewId: viewId || '',
anchorId: recordId,
position: 'after',
});
toast({ description: t('expandRecord.duplicateRecord') });
};

Copy link
Contributor

@boris-w boris-w Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a successful duplicate, the current expand card should be updated with the new record, rather than just closing the expand card.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I found it. I know that recordsServerData triggers rendering. When I duplicate record, the length of recordsServerData keep same. I don't know how to update RecordsServerData.

Copy link
Contributor

@boris-w boris-w Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I found it. I know that recordsServerData triggers rendering. When I duplicate record, the length of recordsServerData keep same. I don't know how to update RecordsServerData.

In fact, recordsServerData will not be updated, recordsServerData is only the initialization data needed for ssr, and will not be used when the page is rendered and the socket is connected, so don't care about it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Now I have to force refresh the page for the duplicated record to render. I have no cules to solve it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try it.

// source
const createdRecords =await this.createRecords(tableId, createRecordsRo);

// aliternative
const createdRecords = await this.prismaService.$tx(
      async () => {
        return await this.createRecords(tableId, createRecordsRo);
      }   
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you ,it works

Copy link
Contributor

@Sky-FE Sky-FE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that every single-record right-click menu in each view needs to have a "Duplicate Record" menu item added, including both the grid view and the kanban view.

@AliceLanniste
Copy link
Contributor Author

AliceLanniste commented Oct 19, 2024

I believe that every single-record right-click menu in each view needs to have a "Duplicate Record" menu item added, including both the grid view and the kanban view.

When I started to implement the duplicate functionality, I actually did it .

the comment in #796 (comment), let me implement it in expand card.

I'm a little dissatisfied with the current implementation,it can't insert a duplicate record after the index of the target record.
so your team members should decide after discussing it.

@AliceLanniste
Copy link
Contributor Author

@boris-w hi, I have completed the pr. can you merge it?

@boris-w
Copy link
Contributor

boris-w commented Oct 29, 2024

Looks like there's a problem merging some files.

@AliceLanniste
Copy link
Contributor Author

what can't files be merged. the result of ci is no conflicts with the base branch. so I don't know what to do next.

@boris-w
Copy link
Contributor

boris-w commented Oct 29, 2024

what can't files be merged. the result of ci is no conflicts with the base branch. so I don't know what to do next.

It looks like you're using merge instead of rebase.

@AliceLanniste
Copy link
Contributor Author

what can't files be merged. the result of ci is no conflicts with the base branch. so I don't know what to do next.

It looks like you're using merge instead of rebase.

OK ,now it‘s work tree is clean

@tea-artist tea-artist merged commit fe5151f into teableio:develop Nov 5, 2024
6 of 7 checks passed
@tea-artist tea-artist linked an issue Nov 26, 2024 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

[Feature Request] Duplicate Rows
6 participants