fix(me): derive activeTab directly from route prop to update instantly on navigation

This commit is contained in:
Gigi
2025-10-21 22:54:48 +02:00
parent f39b926e7b
commit 6522a2871c
2 changed files with 3 additions and 8 deletions

View File

@@ -291,7 +291,7 @@ const Explore: React.FC<ExploreProps> = ({ relayPool, eventStore, settings, acti
} finally {
// loading is already turned off after seeding
}
}, [relayPool, activeAccount, eventStore, settings, visibility.nostrverse, followedPubkeys])
}, [relayPool, activeAccount, eventStore, visibility.nostrverse])
useEffect(() => {
loadData()

View File

@@ -57,7 +57,7 @@ const Me: React.FC<MeProps> = ({
const activeAccount = Hooks.useActiveAccount()
const navigate = useNavigate()
const { filter: urlFilter } = useParams<{ filter?: string }>()
const [activeTab, setActiveTab] = useState<TabType>(propActiveTab || 'highlights')
const activeTab: TabType = propActiveTab || 'highlights'
// Only for own profile
const viewingPubkey = activeAccount?.pubkey
@@ -129,12 +129,7 @@ const Me: React.FC<MeProps> = ({
}
}, [])
// Update local state when prop changes
useEffect(() => {
if (propActiveTab) {
setActiveTab(propActiveTab)
}
}, [propActiveTab])
// activeTab is derived from route prop; no local sync needed
// Sync filter state with URL changes
useEffect(() => {