Shadow refactoring and improvements (#1959)

* Make shadow a type-only concept

* Prevent unnecessary init state recalc

* Use derived state instead of effects

* Batch emitter updates

* Use object first seen time instead of dataUpdatedAt

* Stop threading dataUpdatedAt through

* Use same value consistently
This commit is contained in:
dan 2023-11-21 22:42:30 +00:00 committed by GitHub
parent f18b9b32b0
commit 4c4ba553bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 115 additions and 203 deletions

View file

@ -57,7 +57,6 @@ export const ProfileScreen = withAuthRequired(
} = useResolveDidQuery(name)
const {
data: profile,
dataUpdatedAt,
error: profileError,
refetch: refetchProfile,
isFetching: isFetchingProfile,
@ -100,7 +99,6 @@ export const ProfileScreen = withAuthRequired(
return (
<ProfileScreenLoaded
profile={profile}
dataUpdatedAt={dataUpdatedAt}
moderationOpts={moderationOpts}
hideBackButton={!!route.params.hideBackButton}
/>
@ -125,16 +123,14 @@ export const ProfileScreen = withAuthRequired(
function ProfileScreenLoaded({
profile: profileUnshadowed,
dataUpdatedAt,
moderationOpts,
hideBackButton,
}: {
profile: AppBskyActorDefs.ProfileViewDetailed
dataUpdatedAt: number
moderationOpts: ModerationOpts
hideBackButton: boolean
}) {
const profile = useProfileShadow(profileUnshadowed, dataUpdatedAt)
const profile = useProfileShadow(profileUnshadowed)
const {currentAccount} = useSession()
const setMinimalShellMode = useSetMinimalShellMode()
const {openComposer} = useComposerControls()