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

refactor: silentUndoCache #323

Merged
merged 12 commits into from
Feb 7, 2020
Merged

refactor: silentUndoCache #323

merged 12 commits into from
Feb 7, 2020

Conversation

jinwoo-kim-nhn
Copy link
Contributor

@jinwoo-kim-nhn jinwoo-kim-nhn commented Feb 5, 2020

isSilent command를 위한 undoData를 캐시하는 방식 리팩토링

  • 이전 PR에서 의논된 부분의 개선입니다.

  • 문제점

    • 기존 fabric object 객체에 undoData 값을 직접 캐시하여 fabric 객체 데이터 자체와 undoData (command에 책임이 있다)의 커플링이 생기는 문제가 있었다
  • 개선

    • undoData의 캐시를 커맨드 별로 static한 변수를 만들어 커맨드별로 관리되도록 개선
    • 각각의 커맨드 마다 setUndoData를 하는 코드의 패턴이 동일한 패턴을 보이므로 일반화 하여 부모 클래스에서 처리되도록 함

@jinwoo-kim-nhn jinwoo-kim-nhn changed the base branch from master to feat/undoRedoForSliderFilter February 5, 2020 09:03
@jinwoo-kim-nhn jinwoo-kim-nhn changed the title Refactor/silent undo cache refactor: silentUndoCache Feb 6, 2020
setUndoData(undoData, chchedUndoDataForSilent, isSilent) {
if (chchedUndoDataForSilent) {
undoData = chchedUndoDataForSilent;
}
Copy link
Member

Choose a reason for hiding this comment

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

if문이 있어야 할까요? 아래에서 undoData를 쓸 때 삼항연산자로 표현하면 더 깔끔할거 같습니다.

snippet.extend(this.undoData, chchedUndoDataForSilent  ? chchedUndoDataForSilent : undoData);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그렇군요.. 넵. 반영하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아;; 다시보니 바로 아래 부분에서 !isSilent가 아닐때 변경된 undoData를 써야되기때문에 아래로 빼면 안될것 같네요.

* @param {boolean} isSilent - is silent execution or not
* @returns {Object} chchedUndoDataForSilent
*/
setUndoData(undoData, chchedUndoDataForSilent, isSilent) {
Copy link
Member

Choose a reason for hiding this comment

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

cachedUndo~의 오타 인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아;; 오타네요 수정하겠습니다. 감사합니다.

@jinwoo-kim-nhn jinwoo-kim-nhn changed the base branch from feat/undoRedoForSliderFilter to master February 7, 2020 09:58
@jinwoo-kim-nhn jinwoo-kim-nhn merged commit 1f57996 into master Feb 7, 2020
@jinwoo-kim-nhn jinwoo-kim-nhn deleted the refactor/silentUndoCache branch March 20, 2020 08:13
HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
* feat: slider undo redo for filter - middle commit

* middle commit

* feat: prototype complete

* fix: added test and refactoring

* refactor: add jsdoc with filter typename map

* refactor: isSilent for cacheUndodata

* refactor: abstract for chache undo data

* refactor: set undodate with cache for silent command

* refactor: change static variable for cached undoData

* apply codereview

Co-authored-by: superlucky84 <[email protected]>
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.

None yet

3 participants