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

Ignore resize observer loop #321

Merged

Conversation

nicolaskempf57
Copy link
Contributor

No description provided.

Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

I'm not sure I understand why this error is triggered. Could you try to explain it shortly please ? 🙏
What about other errors, such as ResizeObserver is not defined ?

@nicolaskempf57
Copy link
Contributor Author

ResizeObserver is used by the useElementSize function in our read-more component.

It allows us to watch the content height and decide to trigger the read-more or not. It also tells us the correct height to use if the read-more content is smaller than our default read-more height.

The error is quite obscure but the class works as expected as per the spec repo.

The root cause is that we are receiving more than one notification before each frame. An option we can try is to throttle the changes on our side like here and see if it fixes it.

I reproduce this error on a Safari 16.0 and it's caused on launch, maybe because of the internal initial value.

Regarding the errors ResizeObserver is not defined and Can't find variable: ResizeObserver, they are triggered on older browsers (not updated since 2019). We can provide a polyfill but the main ones are unmaintained so we'll have to support it ourself.

@nicolaskempf57 nicolaskempf57 merged commit b0d43c0 into datagouv:master Nov 24, 2023
7 checks passed
@nicolaskempf57 nicolaskempf57 deleted the fix/resize-observer-loop branch November 24, 2023 09:10
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