Bluesky app fork with some witchin' additions 💫

unproxy preferences

authored by whey.party and committed by Tangled 45584b9c 6b305f26

Changed files
+19 -2
src
state
queries
preferences
session
+1 -1
src/state/queries/preferences/index.ts
··· 22 type ThreadViewPreferences, 23 type UsePreferencesQueryResponse, 24 } from '#/state/queries/preferences/types' 25 - import {useAgent} from '#/state/session' 26 import {saveLabelers} from '#/state/session/agent-config' 27 28 export * from '#/state/queries/preferences/const'
··· 22 type ThreadViewPreferences, 23 type UsePreferencesQueryResponse, 24 } from '#/state/queries/preferences/types' 25 + import {useBlankPrefAuthedAgent as useAgent} from '#/state/session' 26 import {saveLabelers} from '#/state/session/agent-config' 27 28 export * from '#/state/queries/preferences/const'
+6
src/state/session/agent.ts
··· 348 this.sessionManager.session = undefined 349 this.persistSessionHandler = undefined 350 } 351 } 352 353 export type {BskyAppAgent}
··· 348 this.sessionManager.session = undefined 349 this.persistSessionHandler = undefined 350 } 351 + 352 + cloneWithoutProxy(): BskyAgent { 353 + const cloned = new BskyAgent({service: this.serviceUrl.toString()}) 354 + cloned.sessionManager.session = this.sessionManager.session 355 + return cloned 356 + } 357 } 358 359 export type {BskyAppAgent}
+12 -1
src/state/session/index.tsx
··· 1 - import React from 'react' 2 import {type AtpSessionEvent, type BskyAgent} from '@atproto/api' 3 4 import {isWeb} from '#/platform/detection' ··· 390 } 391 return agent 392 }
··· 1 + import React, {useMemo} from 'react' 2 import {type AtpSessionEvent, type BskyAgent} from '@atproto/api' 3 4 import {isWeb} from '#/platform/detection' ··· 390 } 391 return agent 392 } 393 + 394 + export function useBlankPrefAuthedAgent(): BskyAgent { 395 + const agent = React.useContext(AgentContext) 396 + if (!agent) { 397 + throw Error('useAgent() must be below <SessionProvider>.') 398 + } 399 + 400 + return useMemo(() => { 401 + return (agent as BskyAppAgent).cloneWithoutProxy() 402 + }, [agent]) 403 + }