Skip to content

Commit

Permalink
feat(swan): 百度也加上绕开 diff 的后门
Browse files Browse the repository at this point in the history
#5277,百度安卓下按路径更新会导致奇怪的 bug,需要提供后门以绕过
  • Loading branch information
Chen-jj authored and luckyadam committed Jan 21, 2020
1 parent e92c019 commit efaefd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/taro-swan/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {
useImperativeHandle,
useContext,
createContext,
memo
memo,
setIsUsingDiff
} from '@tarojs/taro'
import { shallowEqual } from '@tarojs/utils'

Expand Down Expand Up @@ -87,7 +88,8 @@ export const Taro = {
useContext,
createContext,
memo,
shallowEqual
shallowEqual,
setIsUsingDiff
}

export default Taro
Expand Down
5 changes: 3 additions & 2 deletions packages/taro-swan/src/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
internal_safe_set as safeSet,
commitAttachRef,
Current,
invokeEffects
invokeEffects,
getIsUsingDiff
} from '@tarojs/taro'
import { componentTrigger } from './create-component'
import { shakeFnFromObject, isEmptyObject, diffObjToPath, isFunction, isUndefined, isArray } from './util'
Expand Down Expand Up @@ -173,7 +174,7 @@ function doUpdate (component, prevProps, prevState) {
}
data['$taroCompReady'] = true

const dataDiff = diffObjToPath(data, component.$scope.data)
const dataDiff = getIsUsingDiff() ? diffObjToPath(data, component.$scope.data) : data
const __mounted = component.__mounted
let snapshot
if (__mounted) {
Expand Down

0 comments on commit efaefd4

Please sign in to comment.