mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Use scopeStore in useScopeValueSetterOnly (#16341)
GitOrigin-RevId: ed3c5937bafc984440ee262c8cb0c1ba63f0be7d
This commit is contained in:
parent
eb3e5037f8
commit
12646d0541
1 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@ export default function useScopeValueSetterOnly<T = any>(
|
|||
path: string, // dot '.' path of a property in the Angular scope.
|
||||
defaultValue?: T
|
||||
): [T | undefined, Dispatch<SetStateAction<T | undefined>>] {
|
||||
const { $scope } = useIdeContext()
|
||||
const { scopeStore } = useIdeContext()
|
||||
|
||||
const [value, setValue] = useState<T | undefined>(defaultValue)
|
||||
|
||||
|
@ -27,11 +27,11 @@ export default function useScopeValueSetterOnly<T = any>(
|
|||
(newValue: SetStateAction<T | undefined>) => {
|
||||
setValue(val => {
|
||||
const actualNewValue = _.isFunction(newValue) ? newValue(val) : newValue
|
||||
$scope.$applyAsync(() => _.set($scope, path, actualNewValue))
|
||||
scopeStore.set(path, actualNewValue)
|
||||
return actualNewValue
|
||||
})
|
||||
},
|
||||
[path, $scope]
|
||||
[path, scopeStore]
|
||||
)
|
||||
|
||||
return [value, scopeSetter]
|
||||
|
|
Loading…
Reference in a new issue