diff --git a/src/components/Timelines/Timeline/Shared/HeaderDefault/ActionsAccount.tsx b/src/components/Timelines/Timeline/Shared/HeaderDefault/ActionsAccount.tsx index 64a7fe54..c33539a7 100644 --- a/src/components/Timelines/Timeline/Shared/HeaderDefault/ActionsAccount.tsx +++ b/src/components/Timelines/Timeline/Shared/HeaderDefault/ActionsAccount.tsx @@ -32,7 +32,6 @@ const fireMutation = async ({ } break case 'reports': - console.log('reporting') res = await client({ method: 'post', instance: 'local', diff --git a/src/screens/Shared/Compose/Root.tsx b/src/screens/Shared/Compose/Root.tsx index c410b384..4d1e0621 100644 --- a/src/screens/Shared/Compose/Root.tsx +++ b/src/screens/Shared/Compose/Root.tsx @@ -42,7 +42,9 @@ const ComposeRoot: React.FC = ({ postState, postDispatch }) => { { enabled: false } ) useEffect(() => { - refetch() + if (postState.tag?.text) { + refetch() + } }, [postState.tag?.text]) useEffect(() => { diff --git a/src/screens/Shared/Compose/formatText.tsx b/src/screens/Shared/Compose/formatText.tsx index 16d00fab..88578925 100644 --- a/src/screens/Shared/Compose/formatText.tsx +++ b/src/screens/Shared/Compose/formatText.tsx @@ -12,17 +12,21 @@ export interface Params { disableDebounce?: boolean } -const debouncedSuggestions = debounce((postDispatch, tag) => { - console.log('debounced!!!') - postDispatch({ type: 'tag', payload: tag }) -}, 500) +const debouncedSuggestions = debounce( + (postDispatch, tag) => { + postDispatch({ type: 'tag', payload: tag }) + }, + 500, + { + trailing: true + } +) let prevTags: PostState['tag'][] = [] const formatText = ({ postDispatch, content, - refetch, disableDebounce = false }: Params) => { const tags: PostState['tag'][] = [] @@ -54,24 +58,14 @@ const formatText = ({ } }) - const changedTag = differenceWith(prevTags, tags, isEqual) + const changedTag = differenceWith(tags, prevTags, isEqual) // quick delete causes flicking of suggestion box - if ( - changedTag.length > 0 && - tags.length > 0 && - content.length > 0 && - !disableDebounce - ) { - // console.log('changedTag length') - // console.log(changedTag.length) - // console.log('tags length') - // console.log(tags.length) - // console.log('changed Tag') - // console.log(changedTag) + if (changedTag.length && !disableDebounce) { if (changedTag[0]!.type !== 'url') { debouncedSuggestions(postDispatch, changedTag[0]) } } else { + debouncedSuggestions.cancel() postDispatch({ type: 'tag', payload: undefined }) } prevTags = tags diff --git a/src/utils/fetches/searchFetch.ts b/src/utils/fetches/searchFetch.ts index bb01c1e1..d7a2a437 100644 --- a/src/utils/fetches/searchFetch.ts +++ b/src/utils/fetches/searchFetch.ts @@ -19,9 +19,5 @@ export const searchFetch = async ( endpoint: 'search', query: { type, q: term, limit } }) - console.log('search query') - console.log({ type, q: term, limit }) - console.log('search result') - console.log(res.body) return Promise.resolve(res.body) } diff --git a/src/utils/styles/constants.ts b/src/utils/styles/constants.ts index 8f724d60..6e7892ee 100644 --- a/src/utils/styles/constants.ts +++ b/src/utils/styles/constants.ts @@ -3,7 +3,7 @@ const Base = 4 export const StyleConstants = { Font: { Size: { - S: 12, + S: 14, M: 16, L: 18 },