avo-hq / avo

Build Ruby on Rails apps 10x faster
https://avohq.io
Other
1.53k stars 256 forks source link

DX issue: Partial card generated didn't load #3186

Open adrianthedev opened 2 months ago

adrianthedev commented 2 months ago

Discussed in https://github.com/avo-hq/avo/discussions/3185

Originally posted by **cmaxw** August 23, 2024 I used the rails generator to generate a partial card for one of my resources. When I added it to the resource, it wouldn't load. I clicked the link that says "This is not an issue with Avo. Use [this page](http://localhost:3000/portal/resources/Avo::Resources::Meetup/cards/book-club-2024.video_embed?index=0) to see why this frame failed to load." It showed a long backtrace that went into the bowels of Avo's Card rendering. Better Errors clearly wasn't helping here. Then, I looked at my logs. It showed that it had generated a view with `@dashboard.id` called. Since I put this card into a resource, `@dashboard` was `nil` and it caused the error. So, I recommend you either conditionally call `@dashboard.id` or `@resource.id` to avoid the nil issue, or take it out altogether and put the instructions into the generated view as text.

Approach

We should remove the dashboard reference and see if parent works here. If not, let's conditionally add dashboard or resource (but I think parent should work).

w3villa-rohit-kushwaha commented 2 months ago

i wanted to work on it . please assign it to me

Paul-Bob commented 2 months ago

but I think parent should work

Agree.

Thanks for working on this @w3villa-rohit-kushwaha let me know if you need any help