Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧹Marketplace: Remove unused TaxRate partial! #1352

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

zspencer
Copy link
Member

@zspencer zspencer commented Apr 13, 2023

This also makes our have_rendered_turbo_stream matcher play more nicely with remove actions.
Co-authored-by: Kelly Hong <KellyAH@users.noreply.github.com

- #1137

Co-authored-by: Kelly Hong <KellyAH@users.noreply.github.com
@zspencer zspencer requested review from KellyAH and a team April 13, 2023 01:07
@zspencer zspencer added the 🧹 refactor Includes non-behavioral changes label Apr 13, 2023
- #1187

Turns out when we are testing `remove` turbo streams it was trying to
render a partial for the thing to remove.

That's A) unnecessary and B) a recipe for cruft because the inferred
rendering will require partials named for each model; and those partials
may not need to exist if the particular leaf is done using ViewComponent
@@ -25,6 +25,7 @@ def initialize(action, target, content = nil, turbo_stream:, **rendering, &callb
def matches?(response)
@response = response
assert_turbo_stream(action: action, target: target) do
rendering[:allow_inferred_rendering] = false if action == :remove
Copy link
Member

Choose a reason for hiding this comment

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

This change seems unrelated to the description and the rest of this PR. I assume you need this change for something else somewhere else and just decided to pull it into this PR, and this is not a mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, the second commit has more details, but basically assert_turbo_stream presumes you want to :allow_inferred_rendering, so when I removed this partial the TaxRatesController#destroy tests started failing because it wanted to render. When you look at the underlying code for the TurboStreamBuilder, however, the remove action when called directly sets allow_inferred_rendering to false.

I considered calling send(action, ...) so that we would be using the TurboStreamBuilders defaults, but ran into some weirdness that I didn't want to take time to pin down.

Copy link
Member

Choose a reason for hiding this comment

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

My point was not about the implementation, but about the fact that this change does not seem to belong in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, well the reason it is in this PR was because the test was failing when I removed the partial.

@zspencer zspencer merged commit 82c2934 into main Apr 13, 2023
@zspencer zspencer deleted the marketplace/delete-dead-partial branch April 13, 2023 16:25
@zspencer zspencer added this to the 1.0 - Andromeda milestone May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 refactor Includes non-behavioral changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants