https://avo.cool logo
Hi -I think I encountered a bug in Avo Pro, not...
# avo-3
r
Hi -I think I encountered a bug in Avo Pro, not sure if this is the right place to report it. I believe this error happens when you try to go to the /new any resource that is available for global search. This is the backtrace:
Copy code
hashids (1.0.6) lib/hashids.rb:29:in `Integer'
hashids (1.0.6) lib/hashids.rb:29:in `block in encode'
hashids (1.0.6) lib/hashids.rb:29:in `map!'
hashids (1.0.6) lib/hashids.rb:29:in `encode'
prefixed_ids (1.6.1) lib/prefixed_ids/prefix_id.rb:14:in `encode'
prefixed_ids (1.6.1) lib/prefixed_ids.rb:123:in `to_param'
avo-pro (3.27.0) app/components/avo/pro/global_search_component.rb:17:in `extra_params'
avo-pro (3.27.0) app/components/avo/pro/global_search_component.html.erb:5:in `call'
I believe the error is in
Avo::Pro::GlobalSearchComponent#extra_params
- it should be checking for
@resource.record.blank?
instead of
@resource.blank?
m
Thread automatically created by sourcebender in #1138182212655788054
r
Actually, having monkeypatched a fix, I think it should be:
Copy code
return if @resource&.record.blank? || @resource.record.new_record?
l
Hi @rough-student-26326, thanks for reporting this! Indeed, at the first sight, it seems to be a bug in
avo-pro
since the error back-trace points to it. However the root cause of the issue is the [prefixed_ids](https://github.com/excid3/prefixed_ids) gem (on versions lower than 1.7.1) which crashes when
to_param
is called on non persisted records. Now the good news. I opened [this PR](https://github.com/excid3/prefixed_ids/pull/69) on the
prefixed_ids
gem on Jul 1 2024 to fix this exact issue and it was merged and released on the same day! This bug is fixed starting from
prefixed_ids
version
1.7.1
. I would revert the monkey patch and run
bundle update prefixed_ids
instead. That will fix the issue you are facing.
r
Awesome -should have thought about checking that. Thanks!