desktop-example-app icon indicating copy to clipboard operation
desktop-example-app copied to clipboard

Recurring error "key :todos not found in: %Desktop.Menu"

Open adamwight opened this issue 2 years ago • 1 comments

I'm currently running the Todo application in an OS browser mode and I don't see any menu bar, so maybe this is only a partially-supported mode. But an error like this is logged after every user action:

[error] ** (KeyError) key :todos not found in: %Desktop.Menu{__adapter__: %Desktop.Menu.Adapter.Wx{env: {:wx_env, #Reference<0.1510893025.2632056833.118813>, #PID<0.514.0>, 0}, menu_pid: #PID<0.727.0>, menubar: {:wx_ref, 54, :wxMenuBar, []}, menubar_opts: {:taskbar, {:wx_ref, 41, :wxIcon, []}}, taskbar_icon: %Desktop.Wx.TaskBarIcon{fn_create_popup: #Function<4.88399616/0 in Desktop.Menu.Adapter.Wx.create_menubar/3>, skip_popup_menu?: true, wx_taskbar_icon: {:wx_ref, 55, :wxTaskBarIcon, []}}}, app: :todo_app, assigns: %{todos: [%TodoApp.Todo{__meta__: #Ecto.Schema.Metadata<:loaded, "todos">, id: 1, status: "todo", text: "foo"}, %TodoApp.Todo{__meta__: #Ecto.Schema.Metadata<:loaded, "todos">, id: 3, status: "todo", text: "bar"}]}, dom: [], last_render: nil, module: TodoApp.Menu, pid: #PID<0.727.0>}
    (todo_app 1.0.0) lib/todo_app/menu.ex:34: TodoApp.Menu.set_state_icon/1
    (todo_app 1.0.0) lib/todo_app/menu.ex:28: TodoApp.Menu.handle_info/2
    (desktop 1.4.1) lib/desktop/menu.ex:462: Desktop.Menu.invoke_module_func/3
    (desktop 1.4.1) lib/desktop/menu.ex:430: Desktop.Menu.proxy_handle_info/2
    (desktop 1.4.1) lib/desktop/menu.ex:390: Desktop.Menu.handle_info/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

adamwight avatar May 13 '22 20:05 adamwight

Running the application again but with the GTK3 backend, I still see the same error. Seems to be a legitimate bug, the code should probably be checking for :todos under the assigns key.

adamwight avatar May 13 '22 20:05 adamwight