I'm not happy about it, but we need it to be a standard link to make it work. I assume it's because BulkFormController.preventLeavingChangedForm() isn't smart enough.
This reverts commit 91f0a80189.
duh.
Turbo cleverly pre-fetches GET requests to save loading time. But that resulted in dozens of unwanted clones.
Attack of the clones!!!
I checked: even though this route predates the new products screen, it wasn't being used anywhere else. The old products screen uses the API instead.
This page is big enough and it's hard to see how everything works. So links work like links by default (eg edit and clone). Other links and forms are special, and will reload only the frame: this is now explicit in the code.
That was surprisingly easy. Note that it's still shared with SR.
It hides a bit early though: when the web response returns, but before the DOM has been rendered. Something to optimise in the future.
Now the filters, pagination and product forms submit and load within the frame, and work perfectly, yay!
It's still building the whole page on the server.. I think we need Turbo Streams if we want to send back just a partial.
Forms now load without a full page rebuild.
This is not really faster, but a bit smoother because it avoids a full page render in the browser. The default Turbo loading indicator is shown (blue line at top).
But the bulk_update form breaks... hmm
On to the next level!
We've found that we just can't rely in StimulusReflex (and the underlying WebSockets stack) to guarantee a response to a request.
Because of this, there was intermittent issues when the server was overloaded with large requests, and the response never arrived, leaving an infinite loader, and a poor user wondering if anything was still happening.
- Only display the tax_category name if the tax_category_id is present
- tax_category is overriden in the variant model
- if tax category is not present, then return the default tax category
Watch out, HAML will strip an attribute with boolean false, so we need to use a string. Or reconsider using false as a default value..
I wish Jest had the rspec concept of `let`.
Unfortunately we can't use an input[type=number] because you're allowed to type text for unit_description.
These fields will be conditionally shown/hidden in upcoming steps.