Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(icon-view): do not show a broken image #1399

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

reme3d2y
Copy link
Contributor

@reme3d2y reme3d2y commented Oct 1, 2024

Проблема

  • IconView юзает useImageLoadingState для предзагрузки картинки, этот хук грузит ее в useEffect, т.е уже после рендера
  • В яндекс-картах АО они добавляют точки на карту так:
    iconMarkup = ReactDOMServer.renderToStaticMarkup(placemark.Component);

В итоге useEffect не работает, useImageLoadingState не работает, IconView думает что картинка еще не загрузилась и не рендерит image-тэг — браузер картинку не грузит, точка на карте без картинки 🤷‍♂️

Решение

Скрываем только поломанные изображения
В случае с картами image отрисуется и картинка будет загружена браузером (или нет)

Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: d9cb3b9

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

This PR includes changesets to release 1 package
Name Type
@alfalab/core-components-icon-view Patch

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

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11127198566

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 82.626%

Files with Coverage Reduction New Missed Lines %
packages/date-time-input/src/utils/format.ts 1 92.86%
Totals Coverage Status
Change from base Build 11013175941: -0.007%
Covered Lines: 10336
Relevant Lines: 11436

💛 - Coveralls

@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

@SiebenSieben SiebenSieben merged commit 161ad6b into master Oct 11, 2024
7 checks passed
@SiebenSieben SiebenSieben deleted the fix/icon-view-image-loading branch October 11, 2024 09:12
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.

6 participants