Skip to content

Disable TextAnimation in static contexts #5945

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

Open
wants to merge 1 commit into
base: shauns/06-02-use_rendersingletask_in_app_dev_
Choose a base branch
from

Conversation

shauns
Copy link
Contributor

@shauns shauns commented Jun 5, 2025

WHY are these changes introduced?

Disable loading bar animation in cloud environments and non-TTY contexts to improve CLI behavior in automated environments.

Without this, something like shopify app deploy <opts> &> log.txt will include lots of renders of the rainbow/hill graphic. With this, it's rendered once and not animated, making the log a lot easier to work with


WHAT is this pull request doing?

This PR disables the animated loading bar when running in cloud environments or non-TTY contexts. It:

  1. Adds a new isStatic prop to the TextAnimation component
  2. Modifies the LoadingBar component to detect cloud environments and non-TTY contexts
  3. Passes the detection result to the TextAnimation component to disable animation when appropriate

How to test your changes?

  1. Run a command with a loading bar in a regular terminal to verify animation still works
  2. Redirect output to a file (e.g., command > output.txt) to test non-TTY behavior
  3. If possible, test in a cloud environment to verify animation is disabled

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

shauns commented Jun 5, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shauns shauns marked this pull request as ready for review June 5, 2025 11:30
@shauns shauns requested a review from a team as a code owner June 5, 2025 11:30
Copy link
Contributor

github-actions bot commented Jun 5, 2025

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

@shauns shauns force-pushed the shauns/06-05-disable_textanimation_in_static_contexts branch from e41b3b0 to 9cdbf7a Compare June 5, 2025 11:31
@shauns shauns force-pushed the shauns/06-02-use_rendersingletask_in_app_dev_ branch from 13bc6e0 to 6f927cf Compare June 5, 2025 12:09
@shauns shauns force-pushed the shauns/06-05-disable_textanimation_in_static_contexts branch from 9cdbf7a to 6ded782 Compare June 5, 2025 12:09
Copy link
Contributor

@gonzaloriestra gonzaloriestra left a comment

Choose a reason for hiding this comment

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

How can I reproduce the problem in main? I'm trying with p shopify app deploy --force > output.txt, but I can't see the loading bar anywhere 🤔

@shauns shauns force-pushed the shauns/06-02-use_rendersingletask_in_app_dev_ branch from 6f927cf to 97154be Compare June 25, 2025 10:09
@shauns shauns force-pushed the shauns/06-05-disable_textanimation_in_static_contexts branch from 6ded782 to 1203770 Compare June 25, 2025 10:09
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

packages/cli-kit/dist/private/node/ui/hooks/use-exit-on-ctrl-c.d.ts
/**
 * This hook will cause the process to exit when the user presses Ctrl+C.
 */
export declare function useExitOnCtrlC(): void;
packages/cli-kit/dist/private/node/ui/components/LoadingBar.d.ts
import React from 'react';
interface LoadingBarProps {
    title: string;
    noColor?: boolean;
}
declare const LoadingBar: ({ title, noColor }: React.PropsWithChildren<LoadingBarProps>) => JSX.Element;
export { LoadingBar };
packages/cli-kit/dist/private/node/ui/components/SingleTask.d.ts
import React from 'react';
interface SingleTaskProps {
    title: string;
    taskPromise: Promise<unknown>;
    noColor?: boolean;
}
declare const SingleTask: ({ taskPromise, title, noColor }: React.PropsWithChildren<SingleTaskProps>) => JSX.Element | null;
export { SingleTask };

Existing type declarations

packages/cli-kit/dist/public/node/ui.d.ts
@@ -330,6 +330,21 @@ interface RenderTasksOptions {
  * Installing dependencies ...
  */
 export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions }?: RenderTasksOptions): Promise<TContext>;
+/**
+ * Awaits a single promise and displays a loading bar while it's in progress. The promise's result is returned.
+ * @param options - Configuration object
+ * @param options.title - The title to display with the loading bar
+ * @param options.taskPromise - The promise to track
+ * @param renderOptions - Optional render configuration
+ * @returns The result of the promise
+ * @example
+ * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+ * Loading app ...
+ */
+export declare function renderSingleTask<T>({ title, taskPromise }: {
+    title: string;
+    taskPromise: Promise<T> | (() => Promise<T>);
+}, { renderOptions }?: RenderTasksOptions): Promise<T>;
 export interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {
     renderOptions?: RenderOptions;
 }
packages/cli-kit/dist/private/node/ui/components/TextAnimation.d.ts
@@ -2,9 +2,10 @@ import React from 'react';
 interface TextAnimationProps {
     text: string;
     maxWidth?: number;
+    isStatic?: boolean;
 }
 /**
  *  applies a rainbow animation to text.
  */
-declare const TextAnimation: React.MemoExoticComponent<({ text, maxWidth }: TextAnimationProps) => JSX.Element>;
+declare const TextAnimation: React.MemoExoticComponent<({ text, maxWidth, isStatic }: TextAnimationProps) => JSX.Element>;
 export { TextAnimation };
\ No newline at end of file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants