@hotwired/turbo-rails 8.0.13 → 8.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -182,7 +182,7 @@ import "@hotwired/turbo-rails"
182
182
 
183
183
  You can watch [the video introduction to Hotwire](https://hotwired.dev/#screencast), which focuses extensively on demonstrating Turbo in a Rails demo. Then you should familiarize yourself with [Turbo handbook](https://turbo.hotwired.dev/handbook/introduction) to understand Drive, Frames, and Streams in-depth. Finally, dive into the code documentation by starting with [`Turbo::FramesHelper`](https://github.com/hotwired/turbo-rails/blob/main/app/helpers/turbo/frames_helper.rb), [`Turbo::StreamsHelper`](https://github.com/hotwired/turbo-rails/blob/main/app/helpers/turbo/streams_helper.rb), [`Turbo::Streams::TagBuilder`](https://github.com/hotwired/turbo-rails/blob/main/app/models/turbo/streams/tag_builder.rb), and [`Turbo::Broadcastable`](https://github.com/hotwired/turbo-rails/blob/main/app/models/concerns/turbo/broadcastable.rb).
184
184
 
185
- Note that in development, the default Action Cable adapter is the single-process `async` adapter. This means that turbo updates are only broadcast within that same process. So you can't start `bin/rails console` and trigger Turbo broadcasts and expect them to show up in a browser connected to a server running in a separate `bin/dev` or `bin/rails server` process. Instead, you should use the web-console when needing to manaually trigger Turbo broadcasts inside the same process. Add "console" to any action or "<%= console %>" in any view to make the web console appear.
185
+ Note that in development, the default Action Cable adapter is the single-process `async` adapter. This means that turbo updates are only broadcast within that same process. So you can't start `bin/rails console` and trigger Turbo broadcasts and expect them to show up in a browser connected to a server running in a separate `bin/dev` or `bin/rails server` process. Instead, you should use the web-console when needing to manually trigger Turbo broadcasts inside the same process. Add "console" to any action or "<%= console %>" in any view to make the web console appear.
186
186
 
187
187
  ### RubyDoc Documentation
188
188
 
@@ -5490,8 +5490,8 @@ window.Turbo = Turbo$1;
5490
5490
  addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody);
5491
5491
 
5492
5492
  var adapters = {
5493
- logger: self.console,
5494
- WebSocket: self.WebSocket
5493
+ logger: typeof console !== "undefined" ? console : undefined,
5494
+ WebSocket: typeof WebSocket !== "undefined" ? WebSocket : undefined
5495
5495
  };
5496
5496
 
5497
5497
  var logger = {
@@ -5533,12 +5533,11 @@ class ConnectionMonitor {
5533
5533
  isRunning() {
5534
5534
  return this.startedAt && !this.stoppedAt;
5535
5535
  }
5536
- recordPing() {
5536
+ recordMessage() {
5537
5537
  this.pingedAt = now();
5538
5538
  }
5539
5539
  recordConnect() {
5540
5540
  this.reconnectAttempts = 0;
5541
- this.recordPing();
5542
5541
  delete this.disconnectedAt;
5543
5542
  logger.log("ConnectionMonitor recorded connect");
5544
5543
  }
@@ -5737,6 +5736,7 @@ Connection.prototype.events = {
5737
5736
  return;
5738
5737
  }
5739
5738
  const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);
5739
+ this.monitor.recordMessage();
5740
5740
  switch (type) {
5741
5741
  case message_types.welcome:
5742
5742
  if (this.triedToReconnect()) {
@@ -5752,7 +5752,7 @@ Connection.prototype.events = {
5752
5752
  });
5753
5753
 
5754
5754
  case message_types.ping:
5755
- return this.monitor.recordPing();
5755
+ return null;
5756
5756
 
5757
5757
  case message_types.confirmation:
5758
5758
  this.subscriptions.confirmSubscription(identifier);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotwired/turbo-rails",
3
- "version": "8.0.13",
3
+ "version": "8.0.15",
4
4
  "description": "The speed of a single-page web application without having to write any JavaScript",
5
5
  "module": "app/javascript/turbo/index.js",
6
6
  "main": "app/assets/javascripts/turbo.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@hotwired/turbo": "^8.0.13",
23
- "@rails/actioncable": "^7.0"
23
+ "@rails/actioncable": ">=7.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@rollup/plugin-node-resolve": "^11.0.1",