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

[Themes] Theme Dev - Render asset upload errors coming from initial theme upload #5210

Draft
wants to merge 1 commit into
base: jm/error_overlay
Choose a base branch
from

Conversation

jamesmengo
Copy link
Contributor

@jamesmengo jamesmengo commented Jan 15, 2025

WHY are these changes introduced?

When you run theme dev, we upload files that you modify, but we also perform an initial theme upload in the background.

This PR adds results from the initial background upload to the error overlay

WHAT is this pull request doing?

Adds upload errors to the error overlay as the theme upload results are returned.

Known limitation - timing matters.
If you open the localhost window BEFORE the results are returned, the overlay won't render until your next render.

I will introduce hot reloading in a follow-up

🎥 Video uploaded on Graphite:

How to test your changes?

  1. Attempt to upload a theme with invalid assets
  2. Verify error messages are properly stored and displayed
  3. Successfully upload assets and confirm errors are cleared
  4. Test with various error scenarios to ensure proper error message handling

Measuring impact

  • 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

jamesmengo commented Jan 15, 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.

@jamesmengo jamesmengo changed the title [Themes] Add error tracking for theme upload results [Themes] Theme Dev - Render asset upload errors coming from initial theme upload Jan 15, 2025
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

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/themes/types.d.ts
@@ -92,6 +92,10 @@ export interface ThemeFileSystem extends VirtualFileSystem {
     applyIgnoreFilters: <T extends {
         key: string;
     }>(files: T[]) => T[];
+    /**
+     * Stores upload errors returned when uploading files via the Asset API
+     */
+    uploadErrors: Map<Key, string[]>;
 }
 /**
  * Represents a theme on the file system.

Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.16% (-0.01% 🔻)
8893/11832
🟡 Branches
70.28% (-0.02% 🔻)
4342/6178
🟡 Functions 75.06% 2326/3099
🟡 Lines
75.71% (-0.01% 🔻)
8408/11105
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)

Test suite run success

2007 tests passing in 906 suites.

Report generated by 🧪jest coverage report action from 858e418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/theme @shopify/theme package issues Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant