Sean

Joined

250 Experience
2 Lessons Completed
0 Questions Solved

Activity

Posted in How to use ESBuild in Rails with JSBundling Discussion

This is great. Super easy to use and I don't feel like I have to dedicate a month to reading about optimization like webpacker.

The only problem I'm having is that, with an application loaded with controllers, the application.js build gets large pretty quickly. With webpacker, I used a plugin that spit out entrypoints for each controller, so that I could use them on a page-by-page basis (and also import third-party libraries within those controllers to avoid large packs).

I took a look at the esbuild documentation and was able to get sourcemaps by adding sourcemaps: true to the build in esbuild.config.js (using esbuild-rails). I tried splitting: true, format: "esm" but some of my controllers stopped working in unpredictable ways. I gather that it's still very much a work in progress.

I'm trying to wrap my head around a way to separate those controllers without creating import files for each.

Posted in Strategy To Track Progress For Completed Nested Lessons

You're welcome, Dale. Glad it helped :)

Posted in Strategy To Track Progress For Completed Nested Lessons

It seems to me that you could break lessons into another discrete model, which then gets a boolean for completion. That would solve your ordinal problem because the percentage completed of Curriculum would just be the total number of those discrete components completed, regardless of where they sit on the tree. The count for Curriculum could also be essentially static, computed only when you update something yourself; that would make the on-the-fly overall calculation less expensive.

I think this would work best in particular if lessons don't need to be completed in a linear fashion.

Posted in How to use Hotwire in Rails Discussion

I hear you. I think iframes were a little more intuitive because the most complicated operation involved targeting in and out of them.

With the cancel link here, it's a bit tricky--for me, anyway--because unlike the CRUD operations, which you can broadcast to from the model (as was done here), what should be a straightforward operation seems to have no real recourse to things like turbo_stream.replace. Calling 'show' means invoking that turbo_frame_tag, whether you want it or not. You could render a partial without it, but then you lose the Turbo functionality for the next operation.

It's probably a conceptual problem, but for me the rather austere docs don't do a great job of wedding streams and frames (to say nothing of linking them with Stimulus).

Posted in How to use Hotwire in Rails Discussion

Have you noticed that every time you click 'Cancel' from edit, it results in a new nested turbo_frame_tag with the same dom id? It doesn't seem to break anything and it's obvious why it's happening, but it still seems weird to me. I was trying to avoid the same behavior in my own project, but things got messy quickly. I can't figure out how you would call 'show' without the corresponding turbo_frame_tag.

Edit for visual: https://paste.pics/de3344e3cf09a81522d992b37f6edb80
Edit part 2: To be super clear, the above image is of this project, not mine.