Skip to content

feat(pkg.gridvirtualizer): add gridvirtualizer - #88

Merged
unknownproperty merged 3 commits into
mainfrom
154
Jul 17, 2026
Merged

feat(pkg.gridvirtualizer): add gridvirtualizer#88
unknownproperty merged 3 commits into
mainfrom
154

Conversation

@avea-maria

@avea-maria avea-maria commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

fix 154 Добавлен инструмент GridVirtualizer для виртуализации больших списков элементов.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
xi-storybook Ready Ready Preview, Comment Jul 17, 2026 10:14am

Comment thread apps/xi.storybook/src/stories/GridVirtualizer.stories.tsx Outdated
Comment thread apps/xi.storybook/src/stories/GridVirtualizer.stories.tsx Outdated
Comment thread packages/pkg.grid.virtualizer/GridVirtualizer.tsx
Comment thread packages/pkg.grid.virtualizer/GridVirtualizer.tsx
}}
>
{rowItems.map((item) => (
<div key={item.id}>{renderItem(item)}</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И тут бы пропсы прокидывать при необходимости

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что именно в пропсах сюда хочешь прокидывать?
renderItem - это пользовательская функция, которая сама пердается в пропсах, соответственно, все параметры доступны в родителе, где мы рендерем VirtualGrid. Т.е. верстка компонента просиходит в родителе, мы только пердаем item в функцию.
5f5e5205-ea7c-406a-89ed-1450540fe578

@unknownproperty unknownproperty Jul 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не будет ли ни у кого желания в будущем прокинуть какую-либо логику, атрибуты в <div id={item.id}>, получается он родитель у <MaterialsCard>

@avea-maria avea-maria Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут div нужен для использования ключа, но я помещу это во Fragment, что еще и уберет лишний узел в DOM.
Управлять родителем, задавать ему стили и атрибуты мы можем внутри JSX-компонента, который вернёт функция renderItem.
f5f1d39c-9e46-4afc-9297-9663e4c78189

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не помню точно, можно ли key в fragment, тут же ведь получится структура, если будет как на скриншоте:

// Контейнер
<div>
  <div key={0}> // это из компонента
    <div className="w-full"> // тут уже renderItem, элементы оттуда
      <MaterialsCard/>
    </div>
  </div>
  <div key={1}>
    <div className="w-full">
      <MaterialsCard/>
    </div>
  </div>
</div>

@avea-maria avea-maria Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, можно
https://ru.react.dev/reference/react/Fragment#rendering-a-list-of-fragments
Твоя версия для мобильных экранов или в одну колонку.
Screenshot 2026-07-17 at 12 46 05

Comment thread packages/pkg.grid.virtualizer/package.json Outdated
@unknownproperty
unknownproperty merged commit 1cb4fde into main Jul 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants