Skip to content

Conversation

@viralpraxis
Copy link

Since the action_dispatch_integration_test hook is invoked for each integration test, the whole TurboStreamEncoder is (re)defined many times.

Ideally, I think, @encoders[:turbo_stream] should be set once, but since RequestEncoder does not expose straightforward API to check if an encoder is registered, we'd have to use something like

ActionDispatch::RequestEncoder::IdentityEncoder === ActionDispatch::RequestEncoder.encoder(:turbo_stream)

which is not handy.

NB: requiring AS is not necessary -- we can use the self-alias trick instead

Since the `action_dispatch_integration_test` hook is invoked for each integration test, the whole `TurboStreamEncoder` is (re)defined many times. Ideally, I think, `@encoders[:turbo_stream]` should be set once, but since `RequestEncoder` does not expose straightforward API to check if an encoder is registered, we'd have to use something like ```ruby ActionDispatch::RequestEncoder::IdentityEncoder === ActionDispatch::RequestEncoder.encoder(:turbo_stream) ``` which is not handy. NB: requiring AS is not necessary -- we can use the self-alias trick instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant