avo
avo copied to clipboard
Cannot read properties of null (reading 'getBoundingClientRect')
Approach
- [ ] add a check to the
isInViewport
method to see if the elements are present
Describe the bug
The console shows this error on some crm_item_document#new form:
Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
at D1t (avo.base.js:57:24)
at O1t (avo.base.js:73:8)
at HTMLDocument.<anonymous> (avo.base.js:88:5)
at Yc (turbo.es2017-esm.js:344:34)
at O4.notifyApplicationAfterPageLoad (turbo.es2017-esm.js:3158:16)
at O4.visitCompleted (turbo.es2017-esm.js:3062:14)
at w4.visitCompleted (turbo.es2017-esm.js:2417:23)
at v4.complete (turbo.es2017-esm.js:1787:31)
at turbo.es2017-esm.js:1854:26
at async v4.render (turbo.es2017-esm.js:2037:9)
Models and resource files
The resource itself:
class Avo::Resources::CrmItemDocument < Avo::BaseResource
self.includes = [:ref_doc_type, :item]
self.title = lambda {
[record.item.full_name, record.ref_doc_type.name, record.reference].compact_blank.join(' - ')
}
def index_fields
field :ref_doc_type, as: :belongs_to
field :reference, as: :text
field :expires_on, as: :date
end
def fields
main_panel do
field :ref_doc_type, as: :belongs_to, can_create: false, name: 'Document Type', attach_scope: -> { query.in_contact }
field :file, as: :file
field :reference, as: :text
field :expires_on, as: :date
field :item, as: :belongs_to, can_create: false, polymorphic_as: :item, types: [::Contact, ::Company], searchable: true
end
end
end
System configuration
Avo version: 3.3.2
Rails version: 7.1.3
Ruby version: 3.3.0
License type:
- [ ] Community
- [ ] Pro
- [x] Advanced
Are you using Avo monkey patches, overriding views or view components?
- [ ] Yes. If so, please post code samples.
- [x] No
Impact
- [ ] High impact (It makes my app un-usable.)
- [ ] Medium impact (I'm annoyed, but I'll live.)
- [x] Low impact (It's really a tiny thing that I could live with.)
Urgency
- [ ] High urgency (I can't continue development without it.)
- [ ] Medium urgency (I found a workaround, but I'd love to have it fixed.)
- [x] Low urgency (It can wait. I just wanted you to know about it.)