Add a temporary lexicon refactor guard (#235)
* Add a temporary lexicon refactor guard * Fix test * Fix tsconfig formatting
This commit is contained in:
parent
fcd8c7b037
commit
dc7b5a34e7
5 changed files with 54 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
* The root store is the base of all modeled state.
|
||||
*/
|
||||
|
||||
import {makeAutoObservable} from 'mobx'
|
||||
import {makeAutoObservable, runInAction} from 'mobx'
|
||||
import {AtpAgent} from '@atproto/api'
|
||||
import {createContext, useContext} from 'react'
|
||||
import {DeviceEventEmitter, EmitterSubscription} from 'react-native'
|
||||
|
@ -39,6 +39,23 @@ export class RootStoreModel {
|
|||
profiles = new ProfilesViewModel(this)
|
||||
linkMetas = new LinkMetasViewModel(this)
|
||||
|
||||
// HACK
|
||||
// this flag is to track the lexicon breaking refactor
|
||||
// it should be removed once we get that done
|
||||
// -prf
|
||||
hackUpgradeNeeded = false
|
||||
async hackCheckIfUpgradeNeeded() {
|
||||
try {
|
||||
const res = await fetch('https://bsky.social/xrpc/app.bsky.feed.getLikes')
|
||||
await res.text()
|
||||
runInAction(() => {
|
||||
this.hackUpgradeNeeded = res.status !== 501
|
||||
})
|
||||
} catch (e) {
|
||||
this.log.error('Failed to hackCheckIfUpgradeNeeded', {e})
|
||||
}
|
||||
}
|
||||
|
||||
constructor(agent: AtpAgent) {
|
||||
this.agent = agent
|
||||
makeAutoObservable(this, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue