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

fix: cannot edit after sort #2001

Merged
merged 5 commits into from
Dec 19, 2023
Merged

fix: cannot edit after sort #2001

merged 5 commits into from
Dec 19, 2023

Conversation

jajugoguma
Copy link
Contributor

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

Fixed an issue where editing could not be performed after sorting.

In the previous fix, i unobserved all data after sorting. However, i found additional issues where the next behavior did not work as intended (changing the data in the viewport to observable data).

Therefore, we discarded the previous fix and proceeded with a fix that proactively changes the rows that were previously observable data and the rows that are included in the viewport after sorting to observable data.


Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

Comment on lines +47 to 59
data.rawData.forEach((rawRow, index) => {
const { rowKey } = rawRow;

if (isObservable(rawRow) || rowKeysInViewport.includes(rowKey)) {
makeObservable({
store,
rowIndex: index,
silent: false,
lazyObservable: false,
forced: true,
});
}
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rawRow가 반응형 데이터 일 때 대응하는 viewRow가 올바른 속성을 갖도록 하기 위해 이와 같이 수정했습니다.

정렬 후 기존에 반응형 데이터였던 데이터와 새롭게 뷰포트에 나타나는 데이터는 반응형 데이터야 합니다.

const { data, column, id } = store;
const { rawData, viewData } = data;
const { treeColumnName } = column;
const rawRow = rawData[rowIndex];

if (isObservable(rawRow)) {
if (!forced && isObservable(rawRow)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

기존에 반응형 데이터 였던 row를 다시 반응형 데이터로 만들기 위해 forced 인자를 추가했습니다.

Copy link

@jwlee1108 jwlee1108 left a comment

Choose a reason for hiding this comment

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

변경사항 자체는 간단해보이는데 파급력이 커보이니 가능하면 예제 하나씩 화면에서 수동 테스트 해보시는건 어떨까요?

@jajugoguma
Copy link
Contributor Author

변경사항 자체는 간단해보이는데 파급력이 커보이니 가능하면 예제 하나씩 화면에서 수동 테스트 해보시는건 어떨까요?

넵 복합 기능 직접 하나씩 테스트해봤습니다! ㅎㅎㅎ

@jajugoguma jajugoguma merged commit 5b3854b into master Dec 19, 2023
3 of 4 checks passed
@jajugoguma jajugoguma deleted the fix/edit-with-sort branch December 19, 2023 21:46
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.

3 participants