Skip to content

Commit

Permalink
fix: Avoid generate deposit DAO when the dialog is not visible. (#2760)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu authored Jul 7, 2023
1 parent 2995d86 commit 6ec2de6
Show file tree
Hide file tree
Showing 10 changed files with 1,030 additions and 1,556 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: Boostrap
run: |
yarn bootstrap
yarn
env:
CI: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Boostrap
run: |
yarn bootstrap
yarn
env:
CI: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Boostrap
run: |
yarn bootstrap
yarn
yarn build
env:
CI: false
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

lerna run --no-bail --stream precommit
npx lerna run --no-bail --stream precommit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ yarn global add lerna # install lerna globally
After lerna has been installed, run this to install and link dependencies:

```shell
$ yarn bootstrap
$ yarn
$ lerna run rebuild:nativemodules
```

Expand Down
6 changes: 2 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"packages": [
"packages/*"
],
"packages": ["packages/*"],
"version": "0.110.1",
"npmClient": "yarn",
"useWorkspaces": true
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"packages/*"
],
"scripts": {
"bootstrap": "npx cross-env lerna bootstrap && lerna link",
"start:ui": "cd packages/neuron-ui && yarn run start",
"start:wallet": "cd packages/neuron-wallet && yarn run start:debug",
"start": "concurrently \"cross-env BROWSER=none yarn run start:ui\" \"wait-on http://127.0.0.1:3000 && yarn run start:wallet\"",
Expand All @@ -32,7 +31,7 @@
"build:main": "lerna run build --scope=neuron-wallet",
"release": "yarn build && ./scripts/copy-ui-files.sh && ./scripts/release.sh",
"package:test": "yarn build && ./scripts/copy-ui-files.sh && ./scripts/package-for-test.sh",
"test": "cross-env NODE_OPTIONS=--openssl-legacy-provider lerna run --parallel test",
"test": "cross-env NODE_OPTIONS=--openssl-legacy-provider lerna run --parallel --load-env-files=false test",
"test:ci": "yarn build:main && yarn test",
"lint": "lerna run --stream lint",
"postinstall": "husky install && lerna run build --scope=@nervina-labs/ckb-indexer",
Expand All @@ -50,7 +49,7 @@
"eslint": "8.38.0",
"eslint-config-prettier": "8.8.0",
"husky": "8.0.3",
"lerna": "5.6.2",
"lerna": "7.0.0",
"lint-staged": "13.2.1",
"ncp": "2.0.0",
"prettier": "2.8.7",
Expand Down
6 changes: 6 additions & 0 deletions packages/neuron-ui/src/components/NervosDAO/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const useGenerateDaoDepositTx = ({
t,
depositValue,
suggestFeeRate,
showDepositDialog,
}: {
setErrorMessage: React.Dispatch<React.SetStateAction<string>>
clearGeneratedTx: () => void
Expand All @@ -149,10 +150,14 @@ export const useGenerateDaoDepositTx = ({
t: TFunction
depositValue: string
suggestFeeRate: string | number
showDepositDialog: boolean
}) => {
const timer = useRef<ReturnType<typeof setTimeout>>()
useEffect(() => {
clearTimeout(timer.current)
if (!showDepositDialog) {
return
}
timer.current = setTimeout(() => {
setErrorMessage('')
clearGeneratedTx()
Expand Down Expand Up @@ -221,6 +226,7 @@ export const useGenerateDaoDepositTx = ({
isBalanceReserved,
depositValue,
suggestFeeRate,
showDepositDialog,
])
}

Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/components/NervosDAO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ const NervosDAO = () => {
isBalanceReserved,
t,
depositValue,
suggestFeeRate
suggestFeeRate,
showDepositDialog,
})
const updateDepositValue = hooks.useUpdateDepositValue({ setDepositValue })

Expand Down
Loading

1 comment on commit 6ec2de6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Packaging for test is done in 5483212342

Please sign in to comment.