fix(me): restore useEffect to sync propActiveTab to local state on route changes

This commit is contained in:
Gigi
2025-10-21 23:05:17 +02:00
parent f9dda1c5d4
commit 33a31df2b4
2 changed files with 9 additions and 4 deletions

View File

@@ -328,7 +328,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({
relayPool ? <Explore relayPool={relayPool} eventStore={eventStore} settings={settings} activeTab={exploreTab} /> : null
) : undefined}
me={showMe ? (
relayPool ? <Me key={meTab} relayPool={relayPool} eventStore={eventStore} activeTab={meTab} bookmarks={bookmarks} bookmarksLoading={bookmarksLoading} settings={settings} /> : null
relayPool ? <Me relayPool={relayPool} eventStore={eventStore} activeTab={meTab} bookmarks={bookmarks} bookmarksLoading={bookmarksLoading} settings={settings} /> : null
) : undefined}
profile={showProfile && profilePubkey ? (
relayPool ? <Profile relayPool={relayPool} eventStore={eventStore} pubkey={profilePubkey} activeTab={profileTab} /> : null

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: TabType = propActiveTab || 'highlights'
const [activeTab, setActiveTab] = useState<TabType>(propActiveTab || 'highlights')
// Only for own profile
const viewingPubkey = activeAccount?.pubkey
@@ -129,7 +129,12 @@ const Me: React.FC<MeProps> = ({
}
}, [])
// activeTab is derived from route prop; no local sync needed
// Sync activeTab from prop when route changes
useEffect(() => {
if (propActiveTab) {
setActiveTab(propActiveTab)
}
}, [propActiveTab])
// Sync filter state with URL changes
useEffect(() => {
@@ -891,7 +896,7 @@ const Me: React.FC<MeProps> = ({
</div>
</div>
<div className="me-tab-content" key={activeTab}>
<div className="me-tab-content">
{renderTabContent()}
</div>
</div>