mirror of
https://github.com/linsa-io/linsa.git
synced 2026-05-27 17:19:16 +02:00
fix: eager load all deps for link
This commit is contained in:
@@ -65,7 +65,7 @@ export const LinkBottomBar: React.FC = () => {
|
|||||||
const [, setGlobalLinkFormExceptionRefsAtom] = useAtom(
|
const [, setGlobalLinkFormExceptionRefsAtom] = useAtom(
|
||||||
globalLinkFormExceptionRefsAtom,
|
globalLinkFormExceptionRefsAtom,
|
||||||
)
|
)
|
||||||
const { me } = useAccount({ root: { personalLinks: [] } })
|
const { me } = useAccount({ root: { personalLinks: [{}] } })
|
||||||
const personalLink = useCoState(PersonalLink, editId as ID<PersonalLink>)
|
const personalLink = useCoState(PersonalLink, editId as ID<PersonalLink>)
|
||||||
|
|
||||||
const cancelBtnRef = React.useRef<HTMLButtonElement>(null)
|
const cancelBtnRef = React.useRef<HTMLButtonElement>(null)
|
||||||
|
|||||||
@@ -153,8 +153,10 @@ export const LinkForm: React.FC<LinkFormProps> = ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const topicName = form.watch("topic")
|
const topicName = form.watch("topic")
|
||||||
const findTopic =
|
const findTopic = React.useMemo(
|
||||||
me && Topic.findUnique({ topicName }, JAZZ_GLOBAL_GROUP_ID, me)
|
() => me && Topic.findUnique({ topicName }, JAZZ_GLOBAL_GROUP_ID, me),
|
||||||
|
[topicName, me],
|
||||||
|
)
|
||||||
|
|
||||||
const selectedTopic = useCoState(Topic, findTopic, {})
|
const selectedTopic = useCoState(Topic, findTopic, {})
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,15 @@ const LinkList: React.FC<LinkListProps> = () => {
|
|||||||
|
|
||||||
const { deleteLink } = useLinkActions()
|
const { deleteLink } = useLinkActions()
|
||||||
const confirm = useConfirm()
|
const confirm = useConfirm()
|
||||||
const { me } = useAccount({ root: { personalLinks: [{}] } })
|
const { me } = useAccount({
|
||||||
|
root: {
|
||||||
|
personalLinks: [
|
||||||
|
{
|
||||||
|
topic: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const personalLinks = me?.root.personalLinks || []
|
const personalLinks = me?.root.personalLinks || []
|
||||||
const filteredLinks = personalLinks.filter((link) => {
|
const filteredLinks = personalLinks.filter((link) => {
|
||||||
@@ -268,9 +276,7 @@ const LinkList: React.FC<LinkListProps> = () => {
|
|||||||
<div className="relative flex h-full grow flex-col items-stretch overflow-hidden">
|
<div className="relative flex h-full grow flex-col items-stretch overflow-hidden">
|
||||||
<div className="flex h-full w-[calc(100%+0px)] flex-col overflow-hidden pr-0">
|
<div className="flex h-full w-[calc(100%+0px)] flex-col overflow-hidden pr-0">
|
||||||
<div className="relative overflow-y-auto overflow-x-hidden [scrollbar-gutter:auto]">
|
<div className="relative overflow-y-auto overflow-x-hidden [scrollbar-gutter:auto]">
|
||||||
{sortedLinks.map(
|
{sortedLinks.map((linkItem, index) => (
|
||||||
(linkItem, index) =>
|
|
||||||
linkItem && (
|
|
||||||
<LinkItem
|
<LinkItem
|
||||||
key={linkItem.id}
|
key={linkItem.id}
|
||||||
isActive={activeItemIndex === index}
|
isActive={activeItemIndex === index}
|
||||||
@@ -299,8 +305,7 @@ const LinkList: React.FC<LinkListProps> = () => {
|
|||||||
data-keyboard-active={keyboardActiveIndex === index}
|
data-keyboard-active={keyboardActiveIndex === index}
|
||||||
ref={(el) => setElementRef(el, index)}
|
ref={(el) => setElementRef(el, index)}
|
||||||
/>
|
/>
|
||||||
),
|
))}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user