This commit is contained in:
Eric Bailey
2025-06-10 20:03:56 -05:00
parent 9dbeeb0a9e
commit a3e48f8d5a
+10 -2
View File
@@ -1,4 +1,4 @@
import {useId, useState} from 'react'
import {useEffect, useId, useState} from 'react'
import {type AppBskyFeedDefs, AtUri} from '@atproto/api'
import {Logger} from '#/logger'
@@ -57,12 +57,20 @@ export function useUnstablePostSource(key: string) {
)
const source = consumedSources.get(id) || transientSources.get(key)
if (source) {
logger.debug('consume', {key, source})
logger.debug('consume', {id, key, source})
transientSources.delete(key)
consumedSources.set(id, source)
}
return source
})
useEffect(() => {
return () => {
consumedSources.delete(id)
logger.debug('cleanup', {id})
}
}, [id])
return source
}