Skip to content

Simplify embedded check in HomeController#2065

Draft
isikyus wants to merge 1 commit into
Shopify:mainfrom
isikyus:patch-1
Draft

Simplify embedded check in HomeController#2065
isikyus wants to merge 1 commit into
Shopify:mainfrom
isikyus:patch-1

Conversation

@isikyus
Copy link
Copy Markdown

@isikyus isikyus commented Mar 27, 2026

Anything that returns false for .present? (nil, empty strings, or other empty objects) will also return false for != "1". So there should be no need for the initial check.

What this PR does

Simplifies the code in the templated HomeController by removing a redundant check.

Since the template code is added to apps built with shopify_app, it was being checked by our code quality checks (Reek), and raising a reek:DuplicateMethodCall warning for params[:embedded]. Our Reek is probably a bit overzealous, so that might not be a concern for you.

But in this case the extra call isn't doing anything and can safely be removed.

Reviewer's guide to testing

The generated HomeController should work the same way it did before. No changes to functionality.

Things to focus on

I'm not sure there's much to say.
The main things I'd want to confirm are:

  1. Is this worth changing, or is it too minor for you to care about?
  2. Confirm the tests still pass (though I expect they should).

Checklist

Before submitting the PR, please consider if any of the following are needed:

  • Update CHANGELOG.md if the changes would impact users.
    While this isn't a functionality change, it is user-visible due to affecting code generated in users' apps.
  • Update README.md, if appropriate. I don't believe this is necessary for such a minor change.
  • Update any relevant pages in /docs, if necessary. Ditto
  • For security fixes, the Disclosure Policy must be followed. This is not a security fix.

Anything that returns false for `.present?` (`nil`, empty strings, or other empty objects) will also return false for `!= "1"`. So there should be no need for the initial check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant