-
-
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
Feature/better error for missing resource #2062
Feature/better error for missing resource #2062
Conversation
Code Climate has analyzed commit 9bec1b8 and detected 0 issues on this pull request. View more on Code Climate. |
This looks great @bryszard! Thank you! |
Definitely. I have kind of a busy time, but I plan to finish it in the next several days. |
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.
This looks great!
I think this catch can be added to BelongsToField.target_resource
, HasBaseField.field_resource
and HasBaseField.target_resource
.
No worries. Take your time, and thank you for the contribution ❤️ |
f6d5ab9
to
d54ea37
Compare
@Paul-Bob I'm ready for review, although I have a doubt: Since I've merged the newest Do you know what could be the problem? |
They are grouped correctly, give a quick read here https://docs.avohq.io/3.0/resource-panels.html We refactored the way that items are fetched from resource on avo3 allowing more customization Let me know if the docs are clear or if there are some thinks that can be better explained PS: Thank you for the contribution. I'll review it during this week |
I'm checking your commits and you're a legend @bryszard. |
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.
Great PR @bryszard! Thank you!!
I let a comment about removing the error suppression on tests, anything else it's great!
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.
I tweaked the message and the tests.
I noticed that you disabled the error catching, but I think it's important to not do that.
We can check if an error was raised. I pushed a sample on the test you created.
On the last two specs we should not disable the error catching.
We should take a different approach. Maybe like I did on events?
Show the field only if a param
is present?
This way we won't get random crashes when we do other tests or navigate the app, but still be able to test that scenario.
One thing that I'm a bit afraid of is coupling of the database tables.
For example, you can't have an event without a location. So in reality in the UI we will never be able to create an event because it will fail on the new page (no location resource present).
How about making the location optional to the event?
Maybe the same with location and stores?
Thsi way they are not so coupled and will give us some leeway with creating records.
To do:
- Make models less coupled
- remove the error catching from the two unrelated tests
- show the error fields only if a param is present so we can test them
This is solid progress!
Thank you!
Let's address the issues above and we'll be able to merge it very soon.
Thank you guys for the review. I'm back from holiday and will be able to adjust it in the next days. |
@Paul-Bob I think I found the reason - you've moved the
|
@adrianthedev I've applied all the suggestions, but there is one failing spec: After moving the The problem is that I cannot reproduce it locally with |
Ah you meant the menu, yes, on avo versions > 3 the main branch contains mainly community version features, the pro/advanced features are distributed by packages. |
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.
@adrianthedev I've applied all the suggestions, but there is one failing spec:
After moving the
model_missing_resource_spec
tospec/features
now for some reason it is raising#<ActionController::RoutingError: No route matches [GET] "/admin/resources/events">
(eg. here)
spec/features/avo/generators/resource_generator_spec.rb
was overriding than deleting the event resource and controller I pushed a commit with a fix
Great PR this kind of feature will increase developer experience by far!
Thank you!
…nd BelongsToField
b2e0941
to
9bec1b8
Compare
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.
Stellar work @bryszard!
This was a big pain point for Avo users, not getting enough feedback on what's wrong.
Thank you for your time and contribution.
Description
Fixes # 1960
We're adding a better handling for errors when we encounter a missing resource on association fields.
Right now the error is unhelpful and requires developer to understand the internal logic of Avo.
We want to give a better Dev Experience and point to solutions.
Checklist:
Screenshots
Error:
UPDATED WITH NEW MESSAGE
Video
BEFORE APPLYING REVIEW SUGGESTIONS
https://github.com/avo-hq/avo/assets/12682792/3b4f14f8-700a-4770-ba37-cecd66683052
Manual review steps
show_location_field=1
query paramlocations
field.show_location_field=1
query paramlocations
field.show_location_field=1
query param and see the errorshow_location_field=1
query param and see the errorManual reviewer: please leave a comment with output from the test if that's the case.