question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VirtualCollection

See original GitHub issue

Пока размышляю над интерфейсом пропсов. Пришел к следующему:

interface VirtualCollectionProps {
    collection: Collection;
    renderNode: (node: CollectionNode) => ReactNode;
}

В чем цимес: я не очень понимаю, зачем нам рендер-функцию передавать через children, а не через проп, в котором ее можно будет нормально типизировать. Мне также кажется, что не нужно передавать type и children в саму рендер функцию, ибо оно все живет внутри ноды, в которой могут также находиться другая значимая для рендера инфа (загловок section, например).

Алсо, есть вопрос, что мы хотим получить на выходе? Пока я вижу, что это будет два дива (контейнер и иннер), в последнем будут рисоваться элементные дивы с транслейтом по Y, контент которых будет уже определяться рендер-функцией. Впрочем, в теории можно не брать на себя ответственность за отрисовку контейнера (ибо на нем мы по идее будем хотеть кастомные скроллбары юзать при необходимости), тогда надо его передавать через реф в пропсы. Что думаете?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
yarastqtcommented, Nov 26, 2021

Насчет того, что в render приходит type и children это скорее просто черновик обсуждения был, я за то, чтобы передавать полностью узел внутрь рендера и далее уже самому решать, что с ним делать и как показать:

<VirtualCollection>
  {(node) => ...}
</VirtualCollection>
0reactions
yarastqtcommented, Nov 29, 2021

В ходе написания тестов пришла в голову идея, что надо бы еще размер элементов прокидывать. Мы хотим это делать с помощью estimate-функции, или как-то по-другому? Я бы клал функцию вида Node => Number.

А как подобную фичу решают другие библиотеки?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub - starkwang/vue-virtual-collection
The standard way of using a VirtualCollection is to to pass the entire collection of items to it as a single group. This...
Read more >
Virtual Collections - CLARIN ERIC
A virtual collection is a coherent set of links to digital objects (e.g. annotated text, video) that can be easily created, accessed and...
Read more >
Virtual Collection - Digital Atlas of Ancient Life
These models have been developed into topically-arranged Virtual Collections, which may be accessed below. Learn more about the Virtual Collection project here.
Read more >
Virtual Collections | The Journals of Gerontology: Series B
A Virtual Collection is a carefully curated, online only section of an issue of The Journals of Gerontology, Series B: Psychological Sciences and...
Read more >
What is a virtual collection? — oracle-tech
At the highest level, a virtual collection is something that has paging attached to it, and pulls data from the server in batches....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found