From 0a26e78dcbbf48dad5daae73b210e236d706b22c Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Tue, 14 Nov 2023 10:41:55 -0800
Subject: Composer update (react-query refactor) (#1899)

* Move composer state to a context

* Rework composer to use RQ

---------

Co-authored-by: Eric Bailey <git@esb.lol>
---
 src/view/screens/PostThread.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/view/screens/PostThread.tsx')

diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx
index c76bf44e3..752f78dce 100644
--- a/src/view/screens/PostThread.tsx
+++ b/src/view/screens/PostThread.tsx
@@ -10,7 +10,6 @@ import {withAuthRequired} from 'view/com/auth/withAuthRequired'
 import {ViewHeader} from '../com/util/ViewHeader'
 import {PostThread as PostThreadComponent} from '../com/post-thread/PostThread'
 import {ComposePrompt} from 'view/com/composer/Prompt'
-import {useStores} from 'state/index'
 import {s} from 'lib/styles'
 import {useSafeAreaInsets} from 'react-native-safe-area-context'
 import {
@@ -24,14 +23,15 @@ import {useSetMinimalShellMode} from '#/state/shell'
 import {useResolveUriQuery} from '#/state/queries/resolve-uri'
 import {ErrorMessage} from '../com/util/error/ErrorMessage'
 import {CenteredView} from '../com/util/Views'
+import {useComposerControls} from '#/state/shell/composer'
 
 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostThread'>
 export const PostThreadScreen = withAuthRequired(
   observer(function PostThreadScreenImpl({route}: Props) {
-    const store = useStores()
     const queryClient = useQueryClient()
     const {fabMinimalShellTransform} = useMinimalShellMode()
     const setMinimalShellMode = useSetMinimalShellMode()
+    const {openComposer} = useComposerControls()
     const safeAreaInsets = useSafeAreaInsets()
     const {name, rkey} = route.params
     const {isMobile} = useWebMediaQueries()
@@ -54,7 +54,7 @@ export const PostThreadScreen = withAuthRequired(
       if (thread?.type !== 'post') {
         return
       }
-      store.shell.openComposer({
+      openComposer({
         replyTo: {
           uri: thread.post.uri,
           cid: thread.post.cid,
@@ -70,7 +70,7 @@ export const PostThreadScreen = withAuthRequired(
             queryKey: POST_THREAD_RQKEY(resolvedUri.uri || ''),
           }),
       })
-    }, [store, queryClient, resolvedUri])
+    }, [openComposer, queryClient, resolvedUri])
 
     return (
       <View style={s.hContentRegion}>
-- 
cgit 1.4.1

