Conversation
|
Differences Found✅ No packages or licenses were added. SummaryExpand
|
There was a problem hiding this comment.
Pull request overview
This PR adds app extension form mount support for the category translations page, enabling external apps to interact with translation form data through the app extension framework.
- Adds form state emission to the category translation page using the app extension context
- Updates the
@saleor/app-sdkpackage to a pre-release version to support new form payload types - Implements data flow from the translation form to mounted app extensions
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx | Adds useEffect hook to emit category translation form data to app extensions, including field values for category name, description, and SEO fields |
| package.json | Updates @saleor/app-sdk to pre-release version 0.0.0-pr-20251218133314 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| currentValue: "todo", | ||
| originalValue: data.category.name, | ||
| }, | ||
| categoryDescription: { | ||
| type: "editorjs", | ||
| fieldName: "categoryDescription", | ||
| translatedValue: data.translation.description, | ||
| currentValue: "todo", | ||
| originalValue: data.category.description, | ||
| }, | ||
| seoName: { | ||
| type: "short-text", | ||
| fieldName: "seoName", | ||
| translatedValue: data.translation.seoTitle, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoTitle, | ||
| }, | ||
| seoDescription: { | ||
| type: "short-text", | ||
| fieldName: "seoDescription", | ||
| translatedValue: data.translation.seoDescription, | ||
| currentValue: "todo", |
There was a problem hiding this comment.
The currentValue is hardcoded as "todo" which is a placeholder. This should contain the actual current value of the field being edited, similar to how the TranslationsProductsPage uses cachedProductSeoName and other cached values to track changes.
| currentValue: "todo", | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: "todo", | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: "todo", | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: "todo", | |
| currentValue: data.translation.name, | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: data.translation.description, | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: data.translation.seoTitle, | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: data.translation.seoDescription, |
| currentValue: "todo", | ||
| originalValue: data.category.name, | ||
| }, | ||
| categoryDescription: { | ||
| type: "editorjs", | ||
| fieldName: "categoryDescription", | ||
| translatedValue: data.translation.description, | ||
| currentValue: "todo", | ||
| originalValue: data.category.description, | ||
| }, | ||
| seoName: { | ||
| type: "short-text", | ||
| fieldName: "seoName", | ||
| translatedValue: data.translation.seoTitle, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoTitle, | ||
| }, | ||
| seoDescription: { | ||
| type: "short-text", | ||
| fieldName: "seoDescription", | ||
| translatedValue: data.translation.seoDescription, | ||
| currentValue: "todo", |
There was a problem hiding this comment.
The currentValue is hardcoded as "todo" which is a placeholder. This should contain the actual current value of the field being edited, similar to how the TranslationsProductsPage uses cachedProductSeoDescription and other cached values to track changes.
| currentValue: "todo", | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: "todo", | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: "todo", | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: "todo", | |
| currentValue: data.translation?.name, | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: data.translation?.description, | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: data.translation?.seoTitle, | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: data.translation?.seoDescription, |
| }), | ||
| ); | ||
| } | ||
| }, [active, data?.category, data?.category?.id]); |
There was a problem hiding this comment.
The useEffect dependency array is incomplete. It should include languageCode, data?.translation, attachFormState, and the individual data fields being accessed (data.translation.name, data.translation.description, etc.) since these values are used within the effect. Currently, changes to these values won't trigger the effect to re-run as expected.
| }, [active, data?.category, data?.category?.id]); | |
| }, [ | |
| active, | |
| attachFormState, | |
| languageCode, | |
| data?.category?.id, | |
| data?.category?.name, | |
| data?.category?.description, | |
| data?.category?.seoTitle, | |
| data?.category?.seoDescription, | |
| data?.translation?.name, | |
| data?.translation?.description, | |
| data?.translation?.seoTitle, | |
| data?.translation?.seoDescription, | |
| ]); |
| "@graphql-eslint/eslint-plugin": "^4.4.0", | ||
| "@playwright/test": "1.56.1", | ||
| "@saleor/app-sdk": "1.5.0", | ||
| "@saleor/app-sdk": "0.0.0-pr-20251218133314", |
There was a problem hiding this comment.
The version "0.0.0-pr-20251218133314" appears to be a pre-release or PR-specific version. This should not be committed to the main branch and should instead use a stable, published version of the package.
| "@saleor/app-sdk": "0.0.0-pr-20251218133314", | |
| "@saleor/app-sdk": "^0.61.0", |
| languageEntityUrl, | ||
| TranslatableEntities, | ||
| } from "@dashboard/translations/urls"; | ||
| import { DashboardEventFactory } from "@saleor/app-sdk/app-bridge"; |
There was a problem hiding this comment.
This import is unnecessary since attachFormState should receive the payload directly without wrapping it in DashboardEventFactory.createFormEvent. The createFormEvent transformation is handled internally by the framework.
| currentValue: "todo", | ||
| originalValue: data.category.name, | ||
| }, | ||
| categoryDescription: { | ||
| type: "editorjs", | ||
| fieldName: "categoryDescription", | ||
| translatedValue: data.translation.description, | ||
| currentValue: "todo", | ||
| originalValue: data.category.description, | ||
| }, | ||
| seoName: { | ||
| type: "short-text", | ||
| fieldName: "seoName", | ||
| translatedValue: data.translation.seoTitle, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoTitle, | ||
| }, | ||
| seoDescription: { | ||
| type: "short-text", | ||
| fieldName: "seoDescription", | ||
| translatedValue: data.translation.seoDescription, | ||
| currentValue: "todo", |
There was a problem hiding this comment.
The currentValue is hardcoded as "todo" which is a placeholder. This should contain the actual current value of the field being edited, similar to how the TranslationsProductsPage uses cachedProductName and other cached values to track changes.
| currentValue: "todo", | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: "todo", | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: "todo", | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: "todo", | |
| currentValue: data.translation.name, | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: data.translation.description, | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: data.translation.seoTitle, | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: data.translation.seoDescription, |
| attachFormState( | ||
| // @ts-ignore - wtf with types | ||
| DashboardEventFactory.createFormEvent({ | ||
| form: "category-translate", | ||
| categoryId: data.category.id, | ||
| translationLanguage: languageCode, | ||
| fields: { | ||
| categoryName: { | ||
| type: "short-text", | ||
| fieldName: "categoryName", | ||
| translatedValue: data.translation.name, | ||
| currentValue: "todo", | ||
| originalValue: data.category.name, | ||
| }, | ||
| categoryDescription: { | ||
| type: "editorjs", | ||
| fieldName: "categoryDescription", | ||
| translatedValue: data.translation.description, | ||
| currentValue: "todo", | ||
| originalValue: data.category.description, | ||
| }, | ||
| seoName: { | ||
| type: "short-text", | ||
| fieldName: "seoName", | ||
| translatedValue: data.translation.seoTitle, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoTitle, | ||
| }, | ||
| seoDescription: { | ||
| type: "short-text", | ||
| fieldName: "seoDescription", | ||
| translatedValue: data.translation.seoDescription, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoDescription, | ||
| }, | ||
| }, | ||
| }), | ||
| ); |
There was a problem hiding this comment.
The DashboardEventFactory.createFormEvent is being used incorrectly. Based on the codebase patterns (ProductUpdatePage and TranslationsProductsPage), attachFormState should receive the payload directly without wrapping it in DashboardEventFactory.createFormEvent. The createFormEvent is applied internally by the hook when posting to the extension.
| currentValue: "todo", | ||
| originalValue: data.category.name, | ||
| }, | ||
| categoryDescription: { | ||
| type: "editorjs", | ||
| fieldName: "categoryDescription", | ||
| translatedValue: data.translation.description, | ||
| currentValue: "todo", | ||
| originalValue: data.category.description, | ||
| }, | ||
| seoName: { | ||
| type: "short-text", | ||
| fieldName: "seoName", | ||
| translatedValue: data.translation.seoTitle, | ||
| currentValue: "todo", | ||
| originalValue: data.category.seoTitle, | ||
| }, | ||
| seoDescription: { | ||
| type: "short-text", | ||
| fieldName: "seoDescription", | ||
| translatedValue: data.translation.seoDescription, | ||
| currentValue: "todo", |
There was a problem hiding this comment.
The currentValue is hardcoded as "todo" which is a placeholder. This should contain the actual current value of the field being edited, similar to how the TranslationsProductsPage uses cachedProductDescription and other cached values to track changes.
| currentValue: "todo", | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: "todo", | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: "todo", | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: "todo", | |
| currentValue: data.translation.name, | |
| originalValue: data.category.name, | |
| }, | |
| categoryDescription: { | |
| type: "editorjs", | |
| fieldName: "categoryDescription", | |
| translatedValue: data.translation.description, | |
| currentValue: data.translation.description, | |
| originalValue: data.category.description, | |
| }, | |
| seoName: { | |
| type: "short-text", | |
| fieldName: "seoName", | |
| translatedValue: data.translation.seoTitle, | |
| currentValue: data.translation.seoTitle, | |
| originalValue: data.category.seoTitle, | |
| }, | |
| seoDescription: { | |
| type: "short-text", | |
| fieldName: "seoDescription", | |
| translatedValue: data.translation.seoDescription, | |
| currentValue: data.translation.seoDescription, |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6239 +/- ##
==========================================
- Coverage 40.97% 40.96% -0.02%
==========================================
Files 2432 2432
Lines 40949 40961 +12
Branches 9409 9415 +6
==========================================
Hits 16779 16779
- Misses 22932 22943 +11
- Partials 1238 1239 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Scope of the change