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

fix: remove type inferences from components #3195

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/avo/fields/common/badge_viewer_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Avo::Fields::Common::BadgeViewerComponent < Avo::BaseComponent
prop :value, String
prop :value, prop :value, _Union(_String, _Symbol)
adrianthedev marked this conversation as resolved.
Show resolved Hide resolved
prop :options, Hash

def after_initialize
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/filters_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Avo::FiltersComponent < Avo::BaseComponent
prop :filters, _Array(Avo::Filters::BaseFilter), default: [].freeze
prop :resource, _Nilable(Avo::BaseResource)
prop :applied_filters, Hash, default: {}.freeze
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)

def render?
@filters.present?
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/index/grid_item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Avo::Index::GridItemComponent < Avo::BaseComponent

prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :actions, _Nilable(_Array(Avo::BaseAction))

Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/index/resource_controls_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent

prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :view_type, Symbol, default: :table
prop :actions, _Nilable(_Array(Avo::BaseAction))
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/index/resource_grid_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Avo::Index::ResourceGridComponent < Avo::BaseComponent
prop :resources, _Array(_Nilable(Avo::BaseResource))
prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :actions, _Nilable(_Array(Avo::BaseAction)), reader: :public
end
2 changes: 1 addition & 1 deletion app/components/avo/index/resource_table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def before_render
prop :resources, _Nilable(_Array(Avo::BaseResource))
prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :pagy, _Nilable(Pagy)
prop :query, _Nilable(ActiveRecord::Relation)
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/index/table_row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Avo::Index::TableRowComponent < Avo::BaseComponent

prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :actions, _Nilable(_Array(Avo::BaseAction))
prop :fields, _Nilable(_Array(Avo::Fields::BaseField))
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/items/panel_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Avo::Items::PanelComponent < Avo::ResourceComponent
prop :actions, _Nilable(_Array(Avo::BaseAction)), reader: :public
prop :index, _Nilable(Integer), reader: :public
prop :parent_component, _Nilable(ViewComponent::Base)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)

Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/paginator_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Avo::PaginatorComponent < Avo::BaseComponent
prop :resource, _Nilable(Avo::BaseResource)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :pagy, _Nilable(Pagy)
prop :turbo_frame, _Nilable(_Union(String, Symbol)) do |frame|
frame.present? ? CGI.escapeHTML(frame) : :_top
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/panel_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Avo::PanelComponent < Avo::BaseComponent
prop :profile_photo, _Nilable(Avo::ProfilePhoto)
prop :cover_photo, _Nilable(Avo::CoverPhoto)
prop :args, Hash, :**, default: {}.freeze
prop :name, _Nilable(String) do |value|
prop :name, _Nilable(_Union(_String, _Integer)) do |value|
value || @args&.dig(:title)
end

Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/panel_name_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Avo::PanelNameComponent < Avo::BaseComponent
renders_one :body

prop :name, _Nilable(String)
prop :name, _Nilable(_Union(_String, _Integer))
prop :url, _Nilable(String)
prop :target, Symbol, default: :self do |value|
value&.to_sym
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/sidebar_profile_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Avo::SidebarProfileComponent < Avo::BaseComponent
prop :user, _Nilable(ActiveRecord::Base)
prop :user, _Nilable(_Any)

def avatar
if @user.respond_to?(:avatar) && @user.avatar.present?
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/views/resource_edit_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
include Avo::ApplicationHelper

prop :resource, _Nilable(Avo::BaseResource)
prop :record, _Nilable(ActiveRecord::Base)
prop :record, _Nilable(_Any)
prop :actions, _Array(Avo::BaseAction), default: [].freeze
prop :view, Avo::ViewInquirer, default: Avo::ViewInquirer.new(:edit).freeze
prop :display_breadcrumbs, _Boolean, default: true, reader: :public
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/views/resource_index_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
prop :actions, _Array(Avo::BaseAction), default: [].freeze
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :turbo_frame, _Nilable(String), default: ""
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :applied_filters, Hash, default: {}.freeze
prop :query, _Nilable(ActiveRecord::Relation), reader: :public
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/views/resource_show_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
prop :resource, _Nilable(Avo::BaseResource)
prop :reflection, _Nilable(ActiveRecord::Reflection::AbstractReflection)
prop :parent_resource, _Nilable(Avo::BaseResource)
prop :parent_record, _Nilable(ActiveRecord::Base)
prop :parent_record, _Nilable(_Any)
prop :resource_panel, _Nilable(_Array(Avo::BaseAction)), reader: :public
prop :actions, _Array(Avo::BaseAction), default: [].freeze, reader: :public

Expand Down
Loading