Skip to content

Conversation

@deivid-rodriguez
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez commented Oct 23, 2025

What? Why?

Removing enterprises has a few UI problems:

  • Two consecutive confirmation alerts are displayed when you try to do it.
  • Does not show any success or error flash messages.
  • Does a full page reload, so can feel unresponsive if a lot of related DB records need to be removed.
  • When it fails, it weirdly displays the content of our 500 error page on top of the screen (if in production), or a verbose technical error (if in development).

This PR fixes all those issues by moving enterprise removal from mrujs to turbo (which is a technical migration we want to do).

Before (success case)

Delete_Enterprise_Before

After (success case)

Delete_Enterprise_After

Before (failure case)

Enterprise_Removal_Failure_Before

After (failure case)

Enterprise_Removal_Failure_After

What should we test?

  • Visit admin/enterprises page and try deleting some enterprises.
  • You can create enterprises with different dependent records and see the flash error messages, or the successful removal if cascade deletion for those records is allowed.

Release notes

  • User facing changes

Dependencies

#13649

Make enterprise removal use turbo, which provides the following
benefits:

* More responsive removal since there's no full page reload.
* A success flash message (previously nothing was displayed).
* No double alert prompt.

It also goes in the direction of removing mrujs in favor of turbo.
And not dependent on implementation details.
Make sure failure to delete due to dependent objects is handled through
activemodel errors and not by rescuing
`ActiveRecord::DeleteRestrictionError` exceptions.

Previously we would display two alert prompts, and we would weirdly
display the content of our 500 error page on top of the screen.

Now, we display a flash error message explaining the reason to fail to
remove it.
@index = params[:index]

if @object.destroy
flash.now[:success] = Spree.t(:successfully_removed, resource: "Enterprise")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a small bug here, where this particular translation key is not found as expected.

In general there are a few flash message translation bugs which I'll address in a separate PR.

Copy link
Contributor Author

@deivid-rodriguez deivid-rodriguez Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set #13649 as a dependency of this PR, because once that's merged, the system spec that I added will need to be updated to use the properly translated text. Setting this as a draft until that one lands.

@deivid-rodriguez deivid-rodriguez marked this pull request as draft October 23, 2025 15:53
@sigmundpetersen sigmundpetersen moved this from All the things 💤 to In Progress ⚙ in OFN Delivery board Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress ⚙

Development

Successfully merging this pull request may close these issues.

1 participant