From 369373d2aa4b8b93c008caba2225e412d811fb10 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 16 Dec 2024 17:47:24 -0600 Subject: [PATCH] Remove broadcast hack --- src/components/StarterPack/Suggestions.tsx | 64 ---------------------- src/state/persisted/index.web.ts | 6 +- src/view/screens/Search/Explore.tsx | 16 ------ 3 files changed, 2 insertions(+), 84 deletions(-) delete mode 100644 src/components/StarterPack/Suggestions.tsx diff --git a/src/components/StarterPack/Suggestions.tsx b/src/components/StarterPack/Suggestions.tsx deleted file mode 100644 index 53750bd1a7..0000000000 --- a/src/components/StarterPack/Suggestions.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import {View} from 'react-native' -import {ScrollView} from 'react-native-gesture-handler' -import {AppBskyGraphDefs} from '@atproto/api' - -import {logger} from '#/logger' -import {useModerationOpts} from '#/state/preferences/moderation-opts' -import {atoms as a, useBreakpoints, web} from '#/alf' -import {Embed} from './StarterPackCard' - -const DESKTOP_CARD_WIDTH = 400 -const MOBILE_CARD_WIDTH = 300 - -export function Grid({ - isSuggestionsLoading, - error, - starterPacks, -}: { - isSuggestionsLoading: boolean - starterPacks: AppBskyGraphDefs.StarterPackViewBasic[] - error: Error | null -}) { - const moderationOpts = useModerationOpts() - const {gtMobile} = useBreakpoints() - const width = gtMobile ? DESKTOP_CARD_WIDTH : MOBILE_CARD_WIDTH - const isLoading = isSuggestionsLoading || !moderationOpts - const maxLength = gtMobile ? 4 : 6 - - const content = isLoading ? ( - Array(maxLength) - .fill(0) - .map((_, i) => ( - - {/* TODO */} - - )) - ) : error || !starterPacks.length ? null : ( - <> - {starterPacks.slice(0, maxLength).map(starterPack => ( - - - - ))} - - ) - - if (error || (!isLoading && !starterPacks.length)) { - logger.debug(`Not enough starter packs to show suggested starter packs`) - return null - } - - return ( - - - {content} - - - ) -} diff --git a/src/state/persisted/index.web.ts b/src/state/persisted/index.web.ts index 5e3430f6ee..f28b197715 100644 --- a/src/state/persisted/index.web.ts +++ b/src/state/persisted/index.web.ts @@ -63,10 +63,8 @@ export async function write( [key]: value, }) writeToStorage(_state) - setTimeout(() => { - broadcast.postMessage({event: {type: UPDATE_EVENT, key}}) - broadcast.postMessage({event: UPDATE_EVENT}) // Backcompat while upgrading - }, 0) + broadcast.postMessage({event: {type: UPDATE_EVENT, key}}) + broadcast.postMessage({event: UPDATE_EVENT}) // Backcompat while upgrading } write satisfies PersistedApi['write'] diff --git a/src/view/screens/Search/Explore.tsx b/src/view/screens/Search/Explore.tsx index 14a7f4348a..35499613db 100644 --- a/src/view/screens/Search/Explore.tsx +++ b/src/view/screens/Search/Explore.tsx @@ -3,7 +3,6 @@ import {View} from 'react-native' import { AppBskyActorDefs, AppBskyFeedDefs, - AppBskyGraphDefs, moderateProfile, ModerationDecision, ModerationOpts, @@ -35,7 +34,6 @@ import {Props as SVGIconProps} from '#/components/icons/common' import {ListSparkle_Stroke2_Corner0_Rounded as ListSparkle} from '#/components/icons/ListSparkle' import {UserCircle_Stroke2_Corner0_Rounded as Person} from '#/components/icons/UserCircle' import {Loader} from '#/components/Loader' -import * as StarterPackSuggestions from '#/components/StarterPack/Suggestions' import {Text} from '#/components/Typography' function SuggestedItemsHeader({ @@ -249,11 +247,6 @@ type ExploreScreenItems = type: 'trendingTopics' key: string } - | { - type: 'suggestedStarterPacks' - key: string - starterPacks: AppBskyGraphDefs.StarterPackViewBasic[] - } | { type: 'profile' key: string @@ -513,15 +506,6 @@ export function Explore() { case 'trendingTopics': { return } - case 'suggestedStarterPacks': { - return ( - - ) - } case 'profile': { return (