expo_turbo-rails 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7df2a9762950b1d12d5f408be5e92e7cffe5e3a8485dad8e4569f160b1a07e76
4
- data.tar.gz: ed9df95accc8f147e4d82912c91a0447af884c7bb368e15809f618ee6bb3eaa3
3
+ metadata.gz: 919c160a7da9174c38c2afefcc68798c48d243e00fb502e93633ac13548b15f3
4
+ data.tar.gz: 90161d3666fca638f971a4688ad29370e28454b5302f903bfd10dde25ae5e445
5
5
  SHA512:
6
- metadata.gz: abdbfe57321feb855c8ac10a5f4cf0c9b14ef61620bcad5e2dc7c84ec9cebdb0c76b2fed72237ca22453a482064cfe9307ceb02fe9e281309a49751587da3c44
7
- data.tar.gz: 6692bcbc4c835cc1882185c4079198a2f6ec246598e6a42e81ca884471ad555de4bc3775ac261af3c5438a52991256ca8517ca9a65d7cea5982d7a58089d6599
6
+ metadata.gz: 265dcf51dd7e6555212483ccdc12d95f064fdb8ab8da065884fe62e54a964fe7f61b5143d2b03925ac2b1be5fede3abf270c5a5956c7e1cf9549b11876c90eed
7
+ data.tar.gz: 8b643391794d5d27924bfa3f54c4096c51bded528bca628a98ea41322369cc8079813b245ec3968f6fd286a68971560433ed4ef7c944b7419ab37162efe70d38
data/README.md CHANGED
@@ -13,10 +13,10 @@ style tokens it may render. Its optional protected Cable boundary delegates all
13
13
  credentials and resource policy to the host.
14
14
 
15
15
  > [!IMPORTANT]
16
- > Version [`0.3.0`](https://rubygems.org/gems/expo_turbo-rails) is the stable
17
- > release published on 2026-08-13. Manual VoiceOver, TalkBack, and browser
16
+ > Version `0.4.0` is the release version dated 2026-08-18. This commit prepares
17
+ > the gem; it does not publish it. Manual VoiceOver, TalkBack, and browser
18
18
  > screen-reader evidence remains an explicit follow-up and is not claimed by
19
- > the `0.3.0` compatibility surface.
19
+ > the `0.4.0` compatibility surface.
20
20
 
21
21
  ```ruby
22
22
  gem "expo_turbo-rails"
@@ -90,16 +90,34 @@ request decides.
90
90
  | `turbo_frame_tag` | admits the exact Frame output, and normalizes a model class to the same id on every supported `turbo-rails` version | `turbo-rails` |
91
91
  | `turbo_stream` | the Expo Turbo Stream builder | `turbo-rails` |
92
92
  | `turbo_stream_from` | the same signed source with the fixed `:expo` stream-name suffix | `turbo-rails` |
93
- | `dom_id` | the shared target roles below, and a persisted record | Rails |
93
+ | `dom_id` | Rails | Rails |
94
94
  | `cache` | folds the Frame and module identity into the fragment key | Rails |
95
95
 
96
- `dom_id(record, role)` supports the shared `record`, `document`, `frame`,
97
- `list`, `form`, `error`, and `loading` roles. For a persisted `Account` with ID
98
- `7` those are `account_7`, `document_account_7`, `frame_account_7`,
99
- `list_account_7`, `form_account_7`, `error_account_7`, and `loading_account_7`.
100
- Only `:list` accepts a model class, producing `list_account`. Every record role
101
- requires `persisted?` plus a complete `to_key`, so an unsaved record fails
102
- instead of collapsing into a shared `new_*` target.
96
+ `dom_id` is the normal Rails ActionView helper in every format. Saved records,
97
+ unsaved records, model classes, and all prefixes follow Rails. For an `Account`
98
+ with ID `7`, `dom_id(account)` is `account_7`, `dom_id(account, :frame)` is
99
+ `frame_account_7`, and `dom_id(account, :record)` is `record_account_7`. An
100
+ unsaved account and the `Account` class both use `new_account` without a prefix;
101
+ `dom_id(Account, :list)` is `list_account`.
102
+
103
+ Expo-format calls also no longer apply the old Expo-specific role/key character
104
+ validation. Rails now decides which values `dom_id` handles. A host that relied
105
+ on the Expo helper to reject a record key or prefix must validate that value in
106
+ application code.
107
+
108
+ **Migration from 0.3:** Expo Turbo renders previously treated the prefix
109
+ `:record` as no prefix, so `dom_id(account, :record)` returned `account_7`.
110
+ Change that call to `dom_id(account)` before upgrading if the old special case
111
+ was intentional. Expire cached markup or reload retained Frame/Stream targets
112
+ only for this changed ID. Other `dom_id` calls keep their Rails IDs and need no
113
+ cache or reload action.
114
+
115
+ `ExpoTurbo::Rails::DomIds.id_for` remains as a deprecated direct-call wrapper
116
+ for the 0.4 minor release and warns on every call. It keeps the 0.3 rule that a
117
+ default or explicit `:record` role has no prefix. Thus `id_for(account, :record)`
118
+ delegates as `dom_id(account)`, not `dom_id(account, :record)`. Use that exact
119
+ replacement to keep the stable 0.3 result. Other roles delegate as the Rails
120
+ prefix. The wrapper will be removed in 0.5.0.
103
121
 
104
122
  ## Templates and admission
105
123
 
@@ -284,6 +302,9 @@ component, or the server will admit a name the device cannot render.
284
302
  Aliases are not required for this: no HTML element name is reserved, so a host
285
303
  may name a component `a`, `form`, or `input` outright.
286
304
 
305
+ Rails `dom_id` is safe in a shared template. The same saved, unsaved, class, and
306
+ prefixed call returns the same ID for the browser and native client.
307
+
287
308
  ### What a shared template cannot use
288
309
 
289
310
  - **Void-element helpers.** `tag.br` writes `<br>`, which is not well-formed
@@ -293,9 +314,6 @@ may name a component `a`, `form`, or `input` outright.
293
314
  attributes are `action`, `enctype`, `method`, `novalidate`, and `target`,
294
315
  five of HTML's nine, and both the server and the client decoder admit exactly
295
316
  those five. A shared form writes its own element.
296
- - **`dom_id` for a value both audiences must agree on.** It is format-aware by
297
- design, so the same expression produces a different id per audience. Use a
298
- literal id, or accept the divergence deliberately.
299
317
 
300
318
  ## The paired template lint
301
319
 
@@ -347,9 +365,9 @@ host's own test. What it cannot detect is listed in full at the top of
347
365
  `lib/expo_turbo/rails/paired_templates.rb`. Most entries follow from not
348
366
  rendering: a value a helper produces, a value that differs at run time from
349
367
  identical source, anything a partial or layout contributes, a branch only one
350
- audience takes, and semantics behind equal source. `dom_id` is the sharpest of
351
- those: the same expression on both sides still produces two ids. Four follow
352
- from pairing rather than from rendering:
368
+ audience takes, and semantics behind equal source. Rails `dom_id` itself is
369
+ format-neutral, but the lint still cannot evaluate it or another helper. Four
370
+ limits follow from pairing rather than from rendering:
353
371
 
354
372
  - **Nesting.** Start tags are scanned and never built into a tree, so an element
355
373
  that moved to a different parent while keeping its place in the start-tag
@@ -30,6 +30,7 @@ module ExpoTurbo
30
30
  vocabularies = lock.fetch("history").to_h do |entry|
31
31
  manifest_path = path.dirname.join(entry.fetch("manifest"))
32
32
  manifest = JSON.parse(File.binread(manifest_path))
33
+ validate_manifest_identifiers!(manifest)
33
34
  unless manifest["hash"] == entry.fetch("digest")
34
35
  raise ConfigurationError, "Expo Turbo compatibility manifest digest does not match its lock entry"
35
36
  end
@@ -48,10 +49,30 @@ module ExpoTurbo
48
49
  [entry.fetch("digest"), components]
49
50
  end
50
51
  new(lock:, vocabularies:)
51
- rescue SystemCallError, JSON::ParserError, KeyError, TypeError
52
+ rescue SystemCallError, JSON::ParserError, KeyError, NoMethodError, TypeError
52
53
  raise ConfigurationError, "Expo Turbo compatibility lock could not be loaded"
53
54
  end
54
55
 
56
+ def self.validate_manifest_identifiers!(manifest)
57
+ manifest.fetch("modules").each_with_index do |component_module, module_index|
58
+ RegistryIdentifier.validate!(component_module.fetch("name"), "modules[#{module_index}].name")
59
+ end
60
+ manifest.fetch("components").each_with_index do |component, component_index|
61
+ RegistryIdentifier.validate!(component.fetch("tag"), "components[#{component_index}].tag")
62
+ component.fetch("aliases").each_with_index do |alias_name, alias_index|
63
+ RegistryIdentifier.validate!(alias_name, "components[#{component_index}].aliases[#{alias_index}]")
64
+ end
65
+ component.fetch("attributes").each_with_index do |attribute, attribute_index|
66
+ prefix = "components[#{component_index}].attributes[#{attribute_index}]"
67
+ RegistryIdentifier.validate!(attribute.fetch("name"), "#{prefix}.name")
68
+ %w[prop codec].each do |field|
69
+ RegistryIdentifier.validate!(attribute[field], "#{prefix}.#{field}") if attribute.key?(field)
70
+ end
71
+ end
72
+ end
73
+ end
74
+ private_class_method :validate_manifest_identifiers!
75
+
55
76
  def self.parse_descriptor(value)
56
77
  return unless value.is_a?(String)
57
78
 
@@ -97,6 +118,12 @@ module ExpoTurbo
97
118
  digests[digest] = true
98
119
  revisions[revision] = true
99
120
  components = vocabularies.fetch(digest, {})
121
+ components.each_with_index do |(tag, attributes), component_index|
122
+ RegistryIdentifier.validate!(tag, "components[#{component_index}].tag")
123
+ Array(attributes).each_with_index do |attribute, attribute_index|
124
+ RegistryIdentifier.validate!(attribute, "components[#{component_index}].attributes[#{attribute_index}].name")
125
+ end
126
+ end
100
127
  [digest, Entry.new(digest:, revision:, components: components.freeze).freeze]
101
128
  end.freeze
102
129
  current = lock["current"]
@@ -33,7 +33,6 @@ module ExpoTurbo
33
33
  helper ::Turbo::Engine.helpers if defined?(::Turbo::Engine)
34
34
  helper ExpoTurbo::Rails::Attributes::Helper
35
35
  helper ExpoTurbo::Rails::Frames::Helper
36
- helper ExpoTurbo::Rails::DomIds::Helper
37
36
  helper ExpoTurbo::Rails::Streams::Helper
38
37
  helper ExpoTurbo::Rails::Caching::Helper
39
38
  # Vary is applied before any other filter runs, because an after_action
@@ -486,7 +485,9 @@ module ExpoTurbo
486
485
  name = expo_turbo_decode_module_part(encoded_name).force_encoding(Encoding::UTF_8)
487
486
  version = expo_turbo_decode_module_part(encoded_version).force_encoding(Encoding::UTF_8)
488
487
  return unless name.valid_encoding? && version.valid_encoding?
489
- return if expo_turbo_module_part_has_controls?(name) || expo_turbo_module_part_has_controls?(version)
488
+ return if expo_turbo_module_part_has_controls?(name) ||
489
+ !RegistryIdentifier.valid?(name) ||
490
+ expo_turbo_module_part_has_controls?(version)
490
491
 
491
492
  name = name.strip
492
493
  version = version.strip
@@ -519,7 +520,7 @@ module ExpoTurbo
519
520
  end
520
521
 
521
522
  def expo_turbo_module_part_has_controls?(value)
522
- value.each_codepoint.any? { |codepoint| codepoint <= 31 || codepoint == 127 || codepoint.between?(0xFFFE, 0xFFFF) }
523
+ value.each_codepoint.any? { |codepoint| codepoint <= 31 || codepoint == 127 }
523
524
  end
524
525
 
525
526
  # These warnings are not swallowed. A logger that cannot record a
@@ -1,54 +1,44 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "action_view/record_identifier"
4
+ require "active_support/deprecation"
4
5
 
5
6
  module ExpoTurbo
6
7
  module Rails
7
8
  module DomIds
8
- ROLE_PREFIXES = {
9
- record: nil,
10
- document: :document,
11
- frame: :frame,
12
- list: :list,
13
- form: :form,
14
- error: :error,
15
- loading: :loading
16
- }.freeze
9
+ DEPRECATOR_NAME = :expo_turbo_rails
10
+ DEPRECATOR = ActiveSupport::Deprecation.new("0.5.0", "expo_turbo-rails")
11
+ RECORD_DEPRECATION_MESSAGE =
12
+ "ExpoTurbo::Rails::DomIds.id_for is deprecated and will be removed in expo_turbo-rails 0.5.0; " \
13
+ "replace id_for(record) or id_for(record, :record) with dom_id(record), not dom_id(record, :record), " \
14
+ "because the legacy :record role meant no prefix"
17
15
 
18
16
  module_function
19
17
 
20
18
  def id_for(record_or_class, role = :record)
21
- prefix = ROLE_PREFIXES.fetch(role) do
22
- raise ArgumentError, "unsupported Expo Turbo target role: #{role.inspect}"
19
+ DEPRECATOR.warn(deprecation_message(role))
20
+ prefix = case role
21
+ when :record then nil
22
+ else role
23
23
  end
24
+ ActionView::RecordIdentifier.dom_id(record_or_class, prefix)
25
+ end
24
26
 
25
- if record_or_class.is_a?(Class)
26
- raise ArgumentError, "only list targets may be derived from a model class" unless role == :list
27
- raise ArgumentError, "Expo Turbo list targets require a model class" unless record_or_class.respond_to?(:model_name)
28
-
29
- return validate!(ActionView::RecordIdentifier.dom_id(record_or_class, prefix))
27
+ def deprecation_message(role)
28
+ case role
29
+ when :record then return RECORD_DEPRECATION_MESSAGE
30
30
  end
31
31
 
32
- model = record_or_class.respond_to?(:to_model) ? record_or_class.to_model : record_or_class
33
- unless model&.respond_to?(:to_key) && model.respond_to?(:persisted?) && model.persisted?
34
- raise ArgumentError, "Expo Turbo #{role} targets require a persisted model"
32
+ if Symbol === role
33
+ formatted_role = role.inspect
34
+ "ExpoTurbo::Rails::DomIds.id_for is deprecated and will be removed in expo_turbo-rails 0.5.0; " \
35
+ "replace id_for(record, #{formatted_role}) with dom_id(record, #{formatted_role}); keep the #{formatted_role} prefix"
36
+ else
37
+ "ExpoTurbo::Rails::DomIds.id_for is deprecated and will be removed in expo_turbo-rails 0.5.0; " \
38
+ "replace id_for(record, role) with dom_id(record, role); keep the non-:record prefix"
35
39
  end
36
- raise ArgumentError, "Expo Turbo #{role} targets require a persisted model" unless complete_key?(model.to_key)
37
- raise ArgumentError, "Expo Turbo #{role} targets require a model name" unless model.respond_to?(:model_name)
38
-
39
- validate!(ActionView::RecordIdentifier.dom_id(model, prefix))
40
- end
41
-
42
- def complete_key?(key)
43
- key.is_a?(Array) && key.any? && key.all? { |value| value && !value.to_s.empty? }
44
- end
45
- private_class_method :complete_key?
46
-
47
- def validate!(id)
48
- Frames.validate_id!(id, label: "target")
49
- id.freeze
50
40
  end
51
- private_class_method :validate!
41
+ private_class_method :deprecation_message
52
42
  end
53
43
  end
54
44
  end
@@ -5,6 +5,10 @@ module ExpoTurbo
5
5
  class Engine < ::Rails::Engine
6
6
  config.expo_turbo = ActiveSupport::OrderedOptions.new
7
7
 
8
+ initializer "expo_turbo.rails.deprecator" do |app|
9
+ app.deprecators[ExpoTurbo::Rails::DomIds::DEPRECATOR_NAME] = ExpoTurbo::Rails::DomIds::DEPRECATOR
10
+ end
11
+
8
12
  # A lint, not a runtime hook: loading the task does not load the linter,
9
13
  # and no request path reaches either.
10
14
  rake_tasks do
@@ -48,9 +48,9 @@ module ExpoTurbo
48
48
  # - A value a helper produces. `<%= form_with %>`, `<%= link_to %>`, and
49
49
  # `<%= turbo_frame_tag %>` are opaque; their action, href, ids, and
50
50
  # control names are invisible here.
51
- # - A value that differs at run time from identical source. `dom_id` is
52
- # itself format-aware, so the same `<%= dom_id(post, :frame) %>` on both
53
- # sides can still produce two different ids.
51
+ # - A value that differs at run time from identical source. Rails `dom_id`
52
+ # is format-neutral, but another helper or host value can still return
53
+ # different values to the two renders.
54
54
  # - Anything a partial, a layout, or a helper module contributes. Only the
55
55
  # two paired files are read, and a partial pair is linted as its own
56
56
  # pair, against its own counterpart.
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ExpoTurbo
4
+ module Rails
5
+ module RegistryIdentifier
6
+ module_function
7
+
8
+ def validate!(value, field_path, error_class: ConfigurationError)
9
+ unless value.is_a?(String)
10
+ raise error_class,
11
+ "Expo Turbo registry identifier #{field_path} must be a String, got #{value.class}"
12
+ end
13
+ unless value.valid_encoding?
14
+ raise error_class, "Expo Turbo registry identifier #{field_path} is not valid UTF-8"
15
+ end
16
+
17
+ value.each_codepoint.with_index do |codepoint, scalar_index|
18
+ next unless noncharacter?(codepoint)
19
+
20
+ formatted = codepoint.to_s(16).upcase.rjust(4, "0")
21
+ raise error_class,
22
+ "Expo Turbo registry identifier #{field_path} contains Unicode noncharacter U+#{formatted} at scalar index #{scalar_index}"
23
+ end
24
+ value
25
+ end
26
+
27
+ def valid?(value)
28
+ validate!(value, "value")
29
+ true
30
+ rescue ConfigurationError
31
+ false
32
+ end
33
+
34
+ def noncharacter?(codepoint)
35
+ codepoint.between?(0xFDD0, 0xFDEF) ||
36
+ (codepoint <= 0x10FFFF && [0xFFFE, 0xFFFF].include?(codepoint & 0xFFFF))
37
+ end
38
+ end
39
+ end
40
+ end
@@ -100,7 +100,10 @@ module ExpoTurbo
100
100
  end
101
101
 
102
102
  names = {}
103
- modules.each do |component_module|
103
+ modules.each_with_index do |component_module, module_index|
104
+ if component_module.is_a?(Hash) && component_module["name"].is_a?(String)
105
+ RegistryIdentifier.validate!(component_module["name"], "modules[#{module_index}].name")
106
+ end
104
107
  valid = component_module.is_a?(Hash) &&
105
108
  component_module["name"].is_a?(String) &&
106
109
  !component_module["name"].strip.empty? &&
@@ -121,13 +124,17 @@ module ExpoTurbo
121
124
  raise ConfigurationError, "Expo Turbo capability manifest requires a component list"
122
125
  end
123
126
 
124
- component_entries.each_with_object({}) do |component, components|
127
+ component_entries.each_with_index.each_with_object({}) do |(component, component_index), components|
125
128
  unless component.is_a?(Hash) && component["tag"].is_a?(String) && component["aliases"].is_a?(Array)
126
129
  raise ConfigurationError, "Expo Turbo capability manifest components require tags and aliases"
127
130
  end
128
131
  unless component["aliases"].all? { |alias_name| alias_name.is_a?(String) }
129
132
  raise ConfigurationError, "Expo Turbo capability manifest aliases must be strings"
130
133
  end
134
+ RegistryIdentifier.validate!(component["tag"], "components[#{component_index}].tag")
135
+ component["aliases"].each_with_index do |alias_name, alias_index|
136
+ RegistryIdentifier.validate!(alias_name, "components[#{component_index}].aliases[#{alias_index}]")
137
+ end
131
138
  if component.key?("formOwner") && ![true, false].include?(component["formOwner"])
132
139
  raise ConfigurationError, "Expo Turbo capability manifest form ownership must be boolean"
133
140
  end
@@ -141,6 +148,13 @@ module ExpoTurbo
141
148
  end
142
149
  raise ConfigurationError, "Expo Turbo capability manifest components require attribute names" unless valid_attributes
143
150
 
151
+ attributes.each_with_index do |attribute, attribute_index|
152
+ prefix = "components[#{component_index}].attributes[#{attribute_index}]"
153
+ RegistryIdentifier.validate!(attribute["name"], "#{prefix}.name")
154
+ RegistryIdentifier.validate!(attribute["prop"], "#{prefix}.prop") if attribute["prop"].is_a?(String)
155
+ RegistryIdentifier.validate!(attribute["codec"], "#{prefix}.codec") if attribute["codec"].is_a?(String)
156
+ end
157
+
144
158
  attribute_names = attributes.map { |attribute| attribute["name"] }
145
159
  if attribute_names.uniq.length != attribute_names.length
146
160
  raise ConfigurationError, "Expo Turbo capability manifest contains duplicate attributes"
@@ -250,7 +264,11 @@ module ExpoTurbo
250
264
  end
251
265
 
252
266
  def validate_component_name!(name)
253
- unless name.is_a?(String) && !javascript_trim(name).empty?
267
+ unless name.is_a?(String)
268
+ raise ConfigurationError, "Expo Turbo component names must be nonblank strings"
269
+ end
270
+ RegistryIdentifier.validate!(name, "component.name")
271
+ if javascript_trim(name).empty?
254
272
  raise ConfigurationError, "Expo Turbo component names must be nonblank strings"
255
273
  end
256
274
  if RESERVED_COMPONENT_NAMES.include?(name)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ExpoTurbo
4
4
  module Rails
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
@@ -10,6 +10,7 @@ require_relative "rails/protocol"
10
10
  require_relative "rails/media_type"
11
11
  require_relative "rails/route_constraint"
12
12
  require_relative "rails/errors"
13
+ require_relative "rails/registry_identifier"
13
14
  require_relative "rails/template_capabilities"
14
15
  require_relative "rails/compatibility_registry"
15
16
  require_relative "rails/format"
@@ -19,7 +20,6 @@ require_relative "rails/caching"
19
20
  require_relative "rails/frames"
20
21
  require_relative "rails/frames/helper"
21
22
  require_relative "rails/dom_ids"
22
- require_relative "rails/dom_ids/helper"
23
23
  require_relative "rails/streams"
24
24
  require_relative "rails/streams/broadcast_job"
25
25
  require_relative "rails/cable"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expo_turbo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - NoScrubs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-13 00:00:00.000000000 Z
11
+ date: 2026-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actioncable
@@ -130,7 +130,6 @@ files:
130
130
  - lib/expo_turbo/rails/compatibility_registry.rb
131
131
  - lib/expo_turbo/rails/controller.rb
132
132
  - lib/expo_turbo/rails/dom_ids.rb
133
- - lib/expo_turbo/rails/dom_ids/helper.rb
134
133
  - lib/expo_turbo/rails/engine.rb
135
134
  - lib/expo_turbo/rails/errors.rb
136
135
  - lib/expo_turbo/rails/format.rb
@@ -139,6 +138,7 @@ files:
139
138
  - lib/expo_turbo/rails/media_type.rb
140
139
  - lib/expo_turbo/rails/paired_templates.rb
141
140
  - lib/expo_turbo/rails/protocol.rb
141
+ - lib/expo_turbo/rails/registry_identifier.rb
142
142
  - lib/expo_turbo/rails/route_constraint.rb
143
143
  - lib/expo_turbo/rails/streams.rb
144
144
  - lib/expo_turbo/rails/streams/broadcast_job.rb
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ExpoTurbo
4
- module Rails
5
- module DomIds
6
- module Helper
7
- include Format::Helper
8
-
9
- # Rails' own dom_id. For an Expo Turbo render the prefix names a shared
10
- # target role, and every record role requires a persisted record with a
11
- # complete key, so an unsaved record cannot collapse into a shared
12
- # new_* target.
13
- def dom_id(record_or_class, prefix = nil)
14
- return super unless expo_turbo_render?
15
-
16
- DomIds.id_for(record_or_class, prefix.nil? ? :record : prefix.to_sym)
17
- end
18
- end
19
- end
20
- end
21
- end