Skip to content

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

@swombat

Description

@swombat

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions