Skip to content
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

Surface.LiveComponent - Raise (BadMapError) expected a map, got: nil if a component defined update/2 callback #21

Closed
technicalcapt opened this issue Jan 25, 2020 · 1 comment

Comments

@technicalcapt
Copy link

technicalcapt commented Jan 25, 2020

Hi @msaraiva , I updated the latest commit from master and got the following error.
** (BadMapError) expected a map, got: nil

Just tried it in data_component_test.exs

  defmodule StatefulComponent do
    use Surface.LiveComponent

    def update(assigns, socket) do
      {:ok, assign(socket, test: "test")}
    end

    def render(assigns) do
      ~H"""
      <div>Stateful</div>
      """
    end
  end

and running the test will output

** (BadMapError) expected a map, got: nil
     code: {:ok, _view, html} = live_isolated(build_conn(), ViewWithNoBindings)
     stacktrace:
       (elixir) lib/map.ex:744: Map.split(nil, [:__default__])
       (surface) lib/surface/content_handler.ex:21: Surface.ContentHandler.init_contents/1
@msaraiva
Copy link
Member

@technicalcapt fixed on master! Thanks a lot for reporting the issue.

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

No branches or pull requests

2 participants