From 019cb2eb25690a88f9e3cf6aaadadbeae7200f70 Mon Sep 17 00:00:00 2001 From: yuche Date: Thu, 23 Apr 2020 16:22:28 +0800 Subject: [PATCH 1/2] chore: enable lint-staged --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1dd74bde7d5d..d7b96690956e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "type": "git", "url": "git+https://github.com/NervJS/taro.git" }, - "//lint-staged": { + "lint-staged": { "*.{js,jsx}": [ "eslint --fix", "git add" @@ -34,7 +34,7 @@ "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "//pre-commit": "lint-staged" + "pre-commit": "lint-staged" } }, "keywords": [ From eb3ad89d20fb0d8fc052a97001e4c595a7f244cb Mon Sep 17 00:00:00 2001 From: yuche Date: Fri, 24 Apr 2020 14:47:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(runtime):=20useShareAppMessage=20hooks?= =?UTF-8?q?=20=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8=20deps=20close=20#5837?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-runtime/src/dsl/hooks.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/taro-runtime/src/dsl/hooks.ts b/packages/taro-runtime/src/dsl/hooks.ts index c4b6d7ae1adb..9328d55b4a9f 100644 --- a/packages/taro-runtime/src/dsl/hooks.ts +++ b/packages/taro-runtime/src/dsl/hooks.ts @@ -1,10 +1,11 @@ +import type { DependencyList } from 'react' import { PageContext, R as React } from './react' import { getPageInstance, injectPageInstance } from './common' import { PageLifeCycle } from './instance' import { Current } from '../current' const taroHooks = (lifecycle: keyof PageLifeCycle) => { - return (fn: Function) => { + return (fn: Function, deps: DependencyList = []) => { const id = React.useContext(PageContext) React.useLayoutEffect(() => { let inst = getPageInstance(id) @@ -24,7 +25,7 @@ const taroHooks = (lifecycle: keyof PageLifeCycle) => { if (first) { injectPageInstance(inst!, id) } - }, []) + }, deps) } }