fixed comment cache bug in full editor

This commit is contained in:
Sadaqat Ali 2022-06-18 16:35:18 +05:00
parent 1b0d4b1e5f
commit 450eac65e1
4 changed files with 22 additions and 16 deletions

View File

@ -748,7 +748,7 @@ SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
BugsnagReactNative: a96bc039e0e4ec317a8b331714393d836ca60557 BugsnagReactNative: a96bc039e0e4ec317a8b331714393d836ca60557
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872 BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d
@ -759,7 +759,7 @@ SPEC CHECKSUMS:
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FirebaseMessaging: 5e5118a2383b3531e730d974680954c679ca0a13 FirebaseMessaging: 5e5118a2383b3531e730d974680954c679ca0a13
Folly: b73c3869541e86821df3c387eb0af5f65addfab4 Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e
GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b
GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1

View File

@ -48,10 +48,11 @@ export const QuickReplyModalContent = ({
const headerText = const headerText =
selectedPost && (selectedPost.summary || postBodySummary(selectedPost, 150, Platform.OS as any)); selectedPost && (selectedPost.summary || postBodySummary(selectedPost, 150, Platform.OS as any));
const parentAuthor = selectedPost ? selectedPost.author : ''; let parentAuthor = selectedPost ? selectedPost.author : '';
const parentPermlink = selectedPost ? selectedPost.permlink : ''; let parentPermlink = selectedPost ? selectedPost.permlink : '';
const draftId = `${currentAccount.name}/${parentAuthor}/${parentPermlink}`; //different draftId for each user acount let draftId = `${currentAccount.name}/${parentAuthor}/${parentPermlink}`; //different draftId for each user acount
useEffect(() => { useEffect(() => {
handleCloseRef.current = handleSheetClose; handleCloseRef.current = handleSheetClose;
}, [commentValue]); }, [commentValue]);
@ -74,7 +75,7 @@ export const QuickReplyModalContent = ({
// add quick comment value into cache // add quick comment value into cache
const _addQuickCommentIntoCache = (value = commentValue) => { const _addQuickCommentIntoCache = (value = commentValue) => {
const quickCommentDraftData: Draft = { const quickCommentDraftData: Draft = {
author: currentAccount.name, author: currentAccount.name,
body: value body: value

View File

@ -37,15 +37,20 @@ const QuickReplyModal = ({ fetchPost }: QuickReplyModalProps, ref) => {
containerStyle={styles.sheetContent} containerStyle={styles.sheetContent}
keyboardHandlerEnabled keyboardHandlerEnabled
indicatorColor={EStyleSheet.value('$primaryWhiteLightBackground')} indicatorColor={EStyleSheet.value('$primaryWhiteLightBackground')}
onClose={() => handleCloseRef.current()} onClose={() => {
setSelectedPost(null); //set null on sheet close, causing inconsistant cache bug
handleCloseRef.current();
}}
> >
<QuickReplyModalContent {selectedPost && (
fetchPost={fetchPost} <QuickReplyModalContent
selectedPost={selectedPost} fetchPost={fetchPost}
inputRef={inputRef} selectedPost={selectedPost}
sheetModalRef={sheetModalRef} inputRef={inputRef}
handleCloseRef={handleCloseRef} sheetModalRef={sheetModalRef}
/> handleCloseRef={handleCloseRef}
/>
)}
</ActionSheet> </ActionSheet>
</Portal> </Portal>
); );

View File

@ -144,7 +144,7 @@ class EditorContainer extends Component<any, any> {
}); });
if (draftId) { if (draftId) {
this._getStorageDraft(username, isReply, { _id: draftId }); this._getStorageDraft(username, isReply, { _id: draftId });
} }
} }
if (navigationParams.isEdit) { if (navigationParams.isEdit) {