Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
### [Unreleased]
Changes since the last non-beta release.

### [14.2.1] - 2025-04-11
#### Fixed
- Fixed a bug where the `load` event was not firing in Safari. [PR 1729](https://github.com/shakacode/react_on_rails/pull/1729) by [Romex91](https://github.com/Romex91).

### [14.2.0] - 2025-03-03

#### Added
Expand Down
4 changes: 3 additions & 1 deletion node_package/src/clientStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ function isWindow(context: Context): context is Window {

function onPageReady(callback: () => void) {
if (document.readyState === "complete") {
callback();
// When hydrating React from the `readystatechange` listener, Safari skips the `load` event.
// To avoid this, we use a timeout to postpone the callback until after the `load` event.
setTimeout(callback, 0);
} else {
document.addEventListener("readystatechange", function onReadyStateChange() {
onPageReady(callback);
Expand Down