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

Ne resize la carte que lorsque nécessaire #133

Merged
merged 2 commits into from Apr 25, 2023

Conversation

jillro
Copy link
Member

@jillro jillro commented Apr 24, 2023

Utiliser requestAnimationFrame devrait régler les erreurs ResizeObserverLoop

Signed-off-by: Maud Royer <hello@maudroyer.fr>
@jillro jillro temporarily deployed to staging April 24, 2023 15:51 — with GitHub Actions Inactive
@netlify
Copy link

netlify bot commented Apr 24, 2023

Deploy Preview for cartobio-dev ready!

Name Link
🔨 Latest commit 4ef0790
🔍 Latest deploy log https://app.netlify.com/sites/cartobio-dev/deploys/6447a5ddb82dc9000812ba88
😎 Deploy Preview https://deploy-preview-133--cartobio-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -55,8 +55,14 @@ watch(() => props.style, () => {
map.value.triggerRepaint()
}, { deep: true })

useResizeObserver(mapContainer, () => {
map.value.resize()
useResizeObserver(mapContainer, (entries) => {
Copy link
Member

Choose a reason for hiding this comment

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

Je me demande si quand on place le useResizeObserver dans le map.once('load'), on aboutit au même résultat.

Ainsi, c'est un événement d'interface qui le déclenche plutôt qu'une observation permanente d'un effet de clic.
@thom4parisot thom4parisot temporarily deployed to staging April 25, 2023 10:05 — with GitHub Actions Inactive
@thom4parisot
Copy link
Member

thom4parisot commented Apr 25, 2023

Alors au final, le map.value.resize() génère un changement de dimension dans la modale, donc l'événement du useResizeObserver() est constamment relancé (le bug persistait).

Ce que je me raconte, c'est que le changement de "mode" (compact ou fullSize) qui devrait trigger le refresh. Y'a un peu une condition d'exécution — il faut que le clic aie eu lieu, que le composant se soit agrandi, et là on peut déclencher le redimensionnement. C'est pas immédiat au changement de valeur d'une propriété.

@thom4parisot thom4parisot merged commit aa3a92e into v2 Apr 25, 2023
6 checks passed
@thom4parisot thom4parisot deleted the maud/fix/resizeobserver_errors branch April 25, 2023 10:07
@thom4parisot thom4parisot restored the maud/fix/resizeobserver_errors branch May 8, 2023 18:39
@thom4parisot thom4parisot deleted the maud/fix/resizeobserver_errors branch May 8, 2023 18:41
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.

None yet

2 participants