diff options
author | João Ferreiro <ferreiro@pinkroom.dev> | 2022-11-29 17:46:55 +0000 |
---|---|---|
committer | João Ferreiro <ferreiro@pinkroom.dev> | 2022-11-29 17:46:55 +0000 |
commit | 1f16c75121ee324595ca20620b5ec124e43c1b5e (patch) | |
tree | de09f32ef774217ea2693b44d990420b839e078e /src/state/models | |
parent | 3b899bfc66deff242567bdafd9ecce90f5216965 (diff) | |
download | voidsky-1f16c75121ee324595ca20620b5ec124e43c1b5e.tar.zst |
use runInAction in getPhotos model
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/user-local-photos.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/state/models/user-local-photos.ts b/src/state/models/user-local-photos.ts index 4e01f1d94..12b95e376 100644 --- a/src/state/models/user-local-photos.ts +++ b/src/state/models/user-local-photos.ts @@ -1,5 +1,5 @@ import {PhotoIdentifier} from './../../../node_modules/@react-native-camera-roll/camera-roll/src/CameraRoll' -import {makeAutoObservable} from 'mobx' +import {makeAutoObservable, runInAction} from 'mobx' import {CameraRoll} from '@react-native-camera-roll/camera-roll' import {RootStoreModel} from './root-store' @@ -18,8 +18,10 @@ export class UserLocalPhotosModel { } private async _getPhotos() { - CameraRoll.getPhotos({first: 20}).then(r => { - this.photos = r.edges + runInAction(() => { + CameraRoll.getPhotos({first: 20}).then(r => { + this.photos = r.edges + }) }) } } |