未知的错误:RuntimeError:编辑似乎不是React组件



我会收到"未接收错误:RuntimeError:Edit似乎不是React组件"。消息,尽管在同一模块中定义了编辑:

module Components
  module Admin
    module Discounts
      class Layout < Hyperloop::Router::Component
        render(DIV) do
          Switch do
            Route("#{match.url}/index") do
              Redirect(pathname: match.url, search: location.search)
            end
            Route(match.url, exact: true) do |m, l, h|
              Index(match: m, location: l, history: h)
            end
            Route("#{match.url}/:discount_id/edit") do |m, l, h|
              Edit(match: m, location: l, history: h)
            end
            Route("#{match.url}/new") do |m, l, h|
              New(match: m, location: l, history: h)
            end
          end
        end
      end
    end
  end
end
module Components
  module Admin
    module Discounts
      class Edit < Hyperloop::Router::Component
...

但是,我有另一个文件模型/edit.rb,它似乎使用了

module Edit
  def backup(attr_whitelist, assoc_whitelist)
    @saved_attributes = attributes_as_json(attr_whitelist, assoc_whitelist)
  end

关于为什么会这样/如何指向类编辑的任何想法?

看起来您找到了一个错误!

https://github.com/hyperstack-org/hyperstack/issues/181

它是晦涩的,但是如果组件类是嵌套的,并且在外部范围下定义了另一个模块或类,则组件查找失败!

同时您可以

  • 在边缘分支上拾取修复程序
  • 如本期所示或
  • 所示的修补
  • 添加父模块名称(即Discount::Edit(安装时组件名称

最新更新