-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
fix: remove type inferences from components #3195
Conversation
Code Climate has analyzed commit c8317fa and detected 0 issues on this pull request. View more on Code Climate. |
For my error (following https://docs.avohq.io/3.0/guides/rest-api-integration.html), I need to make this change to make it pass. I'm happy to make a separate PR, but it feels like it should be together. FYI class Avo::Views::ResourceEditComponent
...
prop :record, _Nilable(_Any)
...
end |
@@ -1,7 +1,7 @@ | |||
# frozen_string_literal: true | |||
|
|||
class Avo::SidebarProfileComponent < Avo::BaseComponent | |||
prop :user, _Nilable(ActiveRecord::Base) | |||
prop :user, _Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prop :user, _Any | |
prop :user, _Nilable(_Any) |
We discovered a second error today. So far the following would fix our two issues for us: class Avo::PanelComponent < Avo::BaseComponent
...
prop :name, _Nilable(_Union(_String, _Integer)) do |value|
value || @args&.dig(:title)
end
...
end
class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
...
prop :resource, _Nilable(_Any)
...
end |
Lies... This is what I had to do (so far): # in config/initializers/avo.rb
module OverrideAvoPanelComponent
extend ActiveSupport::Concern
included do
prop :name, _Nilable(_Union(_String, _Integer)) do |value|
value || @args&.dig(:title)
end
end
end
module OverrideAvoPanelNameComponent
extend ActiveSupport::Concern
included do
prop :name, _Nilable(_Union(_String, _Integer))
end
end
module OverrideAvoResourceEditComponent
extend ActiveSupport::Concern
included do
prop :record, _Nilable(_Any)
end
end
module OverrideAvoFieldBadgeViewerComponent
extend ActiveSupport::Concern
included do
prop :value, _Union(_String, _Symbol)
end
end
Rails.configuration.to_prepare do
Avo::PanelComponent.include(OverrideAvoPanelComponent)
Avo::PanelNameComponent.include(OverrideAvoPanelNameComponent)
Avo::Fields::Common::BadgeViewerComponent.include(OverrideAvoFieldBadgeViewerComponent)
Avo::Views::ResourceEditComponent.include(OverrideAvoResourceEditComponent)
end |
Thanks @rickychilcott for brainstorming this with us. |
This PR has been merged into Please check the release guide for more information. |
Description
Fixes #3192
Checklist: