Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Motion does not work with Rails 7.1.4? marshal_dump and "one root element" spurious errors? #175

Open
swombat opened this issue Oct 3, 2024 · 2 comments

Comments

@swombat
Copy link

swombat commented Oct 3, 2024

If I take a ViewComponent that works and I add:

  include Motion::Component

Then immediately I get an error that private method 'marshal_dump' called for an instance of MyComponent.

I shouldn't need to, but let's say I create some marshalling methods like:

  def marshal_dump
    [@object, @header, @body, @property, @params, @value, @value_timestamp]
  end

  def marshal_load(array)
    @object, @header, @body, @property, @params, @value, @value_timestamp = array
  end

Then the next error I get is that:

The template for MyComponent can only have one root element.

Hint: Wrap all elements in a single element, such as `<div>` or `<section>`.

This is even though there is indeed just a single <div> component at the root.

I am also running BulletTrain on this app, but this occurs also if you set up a fresh app.

Steps:

  1. set up new rails app (7.1.4)
  2. create a test route/view
  3. install view_components and motion (incl yarn and setup task)
  4. copy the CalculatorComponent from the demo project
  5. try to render it

Result:

private method `marshal_dump' called for an instance of CalculatorComponent

As far as I can tell, Motion does not work with Rails 7.1.4.

Thoughts?

@latortuga
Copy link
Member

Hi @swombat 👋

Thanks for the bug report. I'm not 100% surprised that Motion isn't working well with Rails 7.1+. Unfortunately with the launch of Turbo/Hotwire as the blessed "Rails" way of doing richer frontend interactions, Motion has foundered. We don't have plans at the moment to keep updating it, but we would accept contributions toward maintenance and version support.

Sorry that I don't have a more positive message for you today.

@swombat
Copy link
Author

swombat commented Nov 18, 2024

No worries, thanks for taking the time to respond!

It does feel like "the Rails Way" now is more towards Turbo/Hotwire, with a clear step away from React-style self-contained components.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants