Enqueue cable_ready actions to perform at end of reflex

I think this resolves [this discussion](https://github.com/openfoodfoundation/openfoodnetwork/pull/11163#discussion_r1260531844)

I guess we just didn't know [how it works](https://docs.stimulusreflex.com/guide/cableready.html#order-of-operations) before..
This commit is contained in:
David Cook
2024-03-07 11:42:43 +11:00
parent fcef8e8d7d
commit 8a84e0084f

View File

@@ -116,11 +116,11 @@ class ProductsReflex < ApplicationReflex
producer_options: producers, producer_id: @producer_id,
category_options: categories, category_id: @category_id,
flashes: flash })
).broadcast
)
cable_ready.replace_state(
url: current_url,
).broadcast_later
)
morph :nothing
end
@@ -133,7 +133,7 @@ class ProductsReflex < ApplicationReflex
cable_ready.replace(
selector: "#products-form",
html: render(partial: "admin/products_v3/table", locals:)
).broadcast
)
morph :nothing
# dunno why this doesn't work.