Closed alliedarmour closed 4 years ago
@alliedarmour thank you for taking the time to file this issue. Would you be willing to write a PR with a failing test for this problem?
@alliedarmour did you figure this out, having a similar issue.
I believe view_component_reflexwas written to address this.
@scottbarrow sorry for the late response, yeah I figured out what caused the problem. I mentioned it in the Stimulus Reflex repo over here.
@andrewmcodes This looks awesome, I will give it a try!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Steps to reproduce
In my reflex I want to re-render a view component with the morph directive, like so:
Then my view component is initialized with the user record like this:
I tried to pass the user instance directly aswell, but still same issue. Now, in my view (cause of wicked pdf) I have to render the component with the render_component directive instead of just render.
Now, when I want to re-render just this table with the reflex above, I get the following error:
StimulusReflex::Channel Failed to invoke Order#order_success! http://localhost:3000/users/1/order_cards/new '#<MealComponent:0x000055fe47a95e98 @user=#<User id: 1, name: "Admin User", email: "example@braunfels.org", password_digest: "$2a$10$sx3fPbyQoPfIP4j/iIiGeOYbNw2laFIE.iVwzCxP7ts...", twoFactorEnabled: "enabled", canDoGuestOrder: true, commentedToday: true, hasCommentedThisWeek: true, otp_secret_key: "ZZOJYZGT6ENI2HADWXPELKVAGREEW2VS", created_at: "2020-07-18 11:36:03", updated_at: "2020-07-24 17:18:03", reset_digest: nil, reset_sent_at: nil, workplace_id: 2, has_ldap_connection: nil, salt: "zhxBMJfAmPVW4MiXvCu3", remember_me_token: "T1fgN4zhqdW17juCH6K4", remember_me_token_expires_at: "2020-08-06 07:51:43", user_accountable_type: "ExternalClinicAccount", user_accountable_id: 1>>' is not an ActiveModel-compatible object. It must implement :to_partial_path. /home/mkrs/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/actionview-6.0.3.2/lib/action_view/renderer/partial_renderer.rb:493:in
partial_path'`But as I checked inside the initialize method of the component, it IS implementing :to_partial_path:
Expected behavior
Just the view component should get rendered again, with the new updated list.
Actual behavior
The view component doesn't get rendered, instead I get the error.
System configuration
Rails version: 6.0.3.2
Ruby version: 2.6.5
Gem version: 2.18.0