Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

refactoring for map editor #80

Open
3 tasks
pm5 opened this issue Jun 1, 2018 · 3 comments
Open
3 tasks

refactoring for map editor #80

pm5 opened this issue Jun 1, 2018 · 3 comments
Labels
enhancement Improvements or refactorings on existing features refactoring Reconstruct existing codes

Comments

@pm5
Copy link
Contributor

pm5 commented Jun 1, 2018

  • deleteXXX 全部改成 removeXXX,因為 delete 是 JavaScript 的 keyword 所以 TypeScript 會不開心。cc Add edge, close #63 #76
  • Map/CardMap/Box 裡處理拖拉的邏輯(包含 newlySelected state)抽出來變成獨立的 component,讓這些 object component 恢復為 pure function。
  • React 昇級到 16.4.0。不必然會用到新的修正,但是測試過昇上去會連環爆,有空的時候昇總比沒空的時候昇要好。
@pm5 pm5 added the enhancement Improvements or refactorings on existing features label Jun 1, 2018
@pm5 pm5 mentioned this issue Jun 1, 2018
@pm5
Copy link
Contributor Author

pm5 commented Jun 4, 2018

為了 #65 的拖拉功能,需要透過 ref 對 Konva 實作 dragenterdragleave events,於是需要昇級 types。結果有點複雜,接近人類一般狀況下記憶力的極限。以下筆記:

  • @types/react 某個版本之後才有 createRef

  • 沒有 createRef 看起來 Konva 的一些功能就不能用

  • @typees/react@types/react-dom一起昇。昇完可能要砍掉 node_modulesyarn.lock 重裝才能得到好的 yarn lock

  • [email protected] 只能搭 redux@4,要留在 redux@3 就要定在 [email protected]

  • semantic-ui-react爆炸,要昇到 0.81.1 以上才有 fix

  • 以上都做完以後會跑出

    /Users/pm5/src/sensetw/sensetw/sensemap/src/components/Inbox/Card/index.tsx
    (40,23): Property 'card' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<{}, ComponentState, any>> & Readonly<{ children?: ReactNode; }> & Readonly<{}>'.
    
  • f27121b 修掉以上問題以後才成功。

  • 但結果是 Konva 的拖拉相關 event 不明原因爛掉... 可能有什麼東西沒修到吧

先丟在 https://github.com/SenseTW/sensetw/tree/upgrade

@caasi
Copy link
Contributor

caasi commented Jun 4, 2018

好奇是否可以用 callback ref ?之前我是這樣拿到 Konva node 的:

import { Text as TextNode } from 'konva';

textNode: TextNode | null = null;

// force the reference node to be a Konva Text
// tslint:disable-next-line:no-any
ref={(node: any) => this.textNode = node}

@caasi
Copy link
Contributor

caasi commented Jun 4, 2018

在 action-type branch 中,為了 ThunkDispatch ,我升過 redux-thunkredux ,看來無大礙。

@hychen hychen added this to the M6: 6/19 -7/3 - Product MVP milestone Jun 5, 2018
@hychen hychen changed the title 一些 refactoring refactoring for map editor Jun 5, 2018
@pm5 pm5 removed this from the M6: 6/19 -7/3 - Product MVP milestone Jun 19, 2018
@caasi caasi added the refactoring Reconstruct existing codes label Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvements or refactorings on existing features refactoring Reconstruct existing codes
Projects
None yet
Development

No branches or pull requests

4 participants