-
Notifications
You must be signed in to change notification settings - Fork 527
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
Usage with Turbo::Broadcastable
#910
Comments
This is the quick solution I'm using currently, overriding the class Turbo::Streams::ActionBroadcastJob < ApplicationJob
def perform(stream, action:, target:, **rendering)
rendering[:locals]&.transform_values! do |v|
v.decorate
rescue Draper::UninferrableDecoratorError, NoMethodError
v
end
Turbo::StreamsChannel.broadcast_action_to stream, action: action, target: target, **rendering
end
end |
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Feb 6, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
2 tasks
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Aug 30, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Aug 30, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Aug 30, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Aug 30, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Sep 2, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Alexander-Senko
added a commit
to Alexander-Senko/draper
that referenced
this issue
Sep 12, 2024
Overriding defaults for Turbo broadcast jobs allows one to get decorated objects in model partials by default. Resolves drapergem#910. Requires drapergem#928.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking for a good practice when using decorated objects inside templates broadcasted with Turbo::Broadcastable.
Since the rendering happens in
Turbo::Streams::ActionBroadcastJob
, the objects are getting serialised (#817) and the decoration is lost.The text was updated successfully, but these errors were encountered: