Skip to content

feat/lottie#2035

Open
hextion wants to merge 8 commits intomasterfrom
feat/lottie
Open

feat/lottie#2035
hextion wants to merge 8 commits intomasterfrom
feat/lottie

Conversation

@hextion
Copy link
Collaborator

@hextion hextion commented Feb 2, 2026

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: 4238db0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@alfalab/core-components Minor
@alfalab/core-components-lottie Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

Bundle size report

Entry point Size (minified)
@alfalab/core-components-lottie/index.js 171.8 (+171.80 KB ❌)

@coveralls
Copy link

coveralls commented Feb 2, 2026

Pull Request Test Coverage Report for Build 22579831996

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 81.957%

Totals Coverage Status
Change from base Build 22578546347: 0.0%
Covered Lines: 9583
Relevant Lines: 11598

💛 - Coveralls

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

Demo build

https://core-ds.github.io/core-components/2035

@hextion hextion force-pushed the feat/lottie branch 4 times, most recently from 739f76d to 9dcb40e Compare February 6, 2026 07:17
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Demo build (default)

https://core-ds.github.io/core-components/2035-default

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Demo build (alfasans)

https://core-ds.github.io/core-components/2035-alfasans

@hextion hextion force-pushed the feat/lottie branch 3 times, most recently from 1ad4b85 to 87fc4f0 Compare February 13, 2026 08:32
@hextion hextion force-pushed the feat/lottie branch 2 times, most recently from 53bfe40 to 2a0ca51 Compare March 2, 2026 07:04
@hextion hextion marked this pull request as ready for review March 2, 2026 09:10
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Snapshot release (default)

Successfully released the following packages:

  1. @alfalab/core-components-lottie@1.0.0-1960cb50f1bb912c4c88a4e9041989958f542451

  2. @alfalab/core-components@50.6.0-1960cb50f1bb912c4c88a4e9041989958f542451

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Snapshot release (alfasans)

Successfully released the following packages:

  1. @alfalab/core-components-lottie@1.0.0-alfasans-1960cb50f1bb912c4c88a4e9041989958f542451

  2. @alfalab/core-components@50.6.0-alfasans-1960cb50f1bb912c4c88a4e9041989958f542451

@SiebenSieben SiebenSieben requested a review from Oladii March 13, 2026 07:28
SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

SiebenSieben

This comment was marked as duplicate.

Copy link
Contributor

@SiebenSieben SiebenSieben left a comment

Choose a reason for hiding this comment

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

Отсутствуют unit-тесты. В библиотеке это обязательное требование для каждого компонента — нужен Component.test.tsx. Без тестов сложно гарантировать корректность поведения при будущих изменениях.

export const lottie: Story = {
name: 'Lottie',
render: () => {
return <Lottie animation={{ path: 'http://localhost:9009/twitter-heart.json' }} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

Хардкод localhost — в задеплоенном Storybook это сломается. Нужно использовать относительный путь, аналогично тому как сделано в description.mdx (./twitter-heart.json).

direction={direction}
speed={1}
iterations={0}
direction={direction}
Copy link
Contributor

Choose a reason for hiding this comment

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

Дублирующийся проп direction={direction}. JSX не выдаст ошибку компиляции в MDX, но второй проп перезаписывает первый — нужно убрать одно из вхождений.

[events, reset],
);
useImperativeHandle(playCountRef, () => animation?.playCount ?? 0, [animation]);

Copy link
Contributor

Choose a reason for hiding this comment

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

useImperativeHandle предназначен для кастомизации хендла, прокидываемого наружу через forwardRef. Использование его на внутреннем playCountRef нестандартно и вводит в заблуждение. Достаточно обычного эффекта:

useEffect(() => {
    playCountRef.current = animation?.playCount ?? 0;
}, [animation]);

'max-params': 'off',
'react-hooks/exhaustive-deps':
lottiePkg && isSamePath(process.cwd(), lottiePkg.dir)
? ['warn', { additionalHooks: ['useLayoutEffect_SAFE_FOR_SSR'].join('|') }]
Copy link
Contributor

Choose a reason for hiding this comment

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

Два вопроса по этому изменению:

  1. useLayoutEffect_SAFE_FOR_SSR из @alfalab/hooks используется во всём репозитории, не только в lottie. Если хук нужно добавить в additionalHooks — логичнее сделать это глобально для всех пакетов, а не только при isSamePath(..., lottiePkg.dir).

  2. ["useLayoutEffect_SAFE_FOR_SSR"].join("|") возвращает просто "useLayoutEffect_SAFE_FOR_SSR".join("|") на массиве из одного элемента избыточен.

animationItem.destroy();
// eslint-disable-next-line no-underscore-dangle
animationItem._cbs = [];
setAnimation(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Прямая запись в приватное поле _cbs обходит публичный API lottie-web. При обновлении библиотеки это поле может исчезнуть или изменить структуру, и баг будет трудно отловить. Если это необходимо для предотвращения утечек памяти — стоит добавить подробный комментарий, почему это нельзя сделать через animationItem.destroy() или другой публичный способ.

"tslib": "^2.4.0"
},
"peerDependencies": {
"react": "^16.9.0 || ^17.0.1 || ^18.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Все остальные пакеты в репозитории уже добавили поддержку React 19. Нужно привести в соответствие:

"react": "^16.9.0 || ^17.0.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0 || ^19.0.0"

</div>
);
},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Не хватает displayName — это стандарт библиотеки (см. Button, Checkbox и др.):

Lottie.displayName = "Lottie";

* Дополнительный класс
*/
className?: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

В библиотеке принято поддерживать dataTestId во всех компонентах для использования в автотестах. Нужно добавить проп и прокинуть через data-test-id на корневой элемент.

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.

5 participants