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

fix: Remove a useless if to setShowSpinner(true) #271

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cmd/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function transpileComponent (component, opts = {}) {
let spinner;
const showSpinner = getShowSpinner();
if (opts.optimize) {
if (showSpinner) setShowSpinner(true);
setShowSpinner(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't actually redundant, because setShowSpinner internally sets the spinner show value to false. It's weird logic I know, but it does its job I think (which is to determine if the state needs to be "switched", since the spinner itself is imperatively created). optimizeComponent will then run its own spinner lifecycle, showing and hiding the spinner, after which the showSpinner value will again bubble up to the transpile operation itself.

We only want opimtimizeComponent to show the spinner if it actually already was originally being show, determined by the if (showSpinner) check.

It's convoluted sure, but the logic works!

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is, if showSpinner is false I'm not sure we want to show the spinner? Specifically we need to respect opts.quiet.

({ component } = await optimizeComponent(component, opts));
}

Expand Down
Loading