Skip to content

MWPW-192158: Shared item loading layer for bulk publish#751

Open
Andrei4226 wants to merge 8 commits intomainfrom
MWPW-192158
Open

MWPW-192158: Shared item loading layer for bulk publish#751
Andrei4226 wants to merge 8 commits intomainfrom
MWPW-192158

Conversation

@Andrei4226
Copy link
Copy Markdown
Contributor

@Andrei4226 Andrei4226 commented Apr 9, 2026

Resolves https://jira.corp.adobe.com/browse/MWPW-192158
QA Checklist: https://wiki.corp.adobe.com/display/adobedotcom/M@S+Engineering+QA+Use+Cases

Extracts the shared item selection UI and data-loading logic from the Translation area into common/, making it reusable across features (Bulk Publish, Translations etc.). Decouples all UI components from Store.translationProjects via a new getItemsSelectionStore() abstraction.
Adds portable data-loading utils, shared rendering helpers and full unit test coverage.

Please review all functionalities from the "Select Items" section in the Translation area.

Please do the steps below before submitting your PR for a code review or QA

  • C1. Cover code with Unit Tests
  • C2. Add a Nala test (double check with #fishbags if nala test is needed)
  • C3. Verify all Checks are green (unit tests, nala tests)
  • C4. PR description contains working Test Page link where the feature can be tested
  • C5: you are ready to do a demo from Test Page in PR (bonus: write a working demo script that you'll use on Thursday, you can eventually put in your PR)
  • C.6 read your Jira one more time to validate that you've addressed all AC's and nothing is missing

🧪 Nala E2E Tests

Nala tests run automatically when you open this PR.

To run Nala tests again:

  1. Add the run nala label to this PR (in the right sidebar)
  2. Tests will run automatically on the current commit
  3. Any future commits will also trigger tests as long as the label remains

To stop automatic Nala tests:

  • Remove the run nala label

Note: Tests only run on commits if the run nala label is present. Add the label whenever you need tests to run on new changes.

Test URLs:

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Apr 9, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 96.29187% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.48%. Comparing base (0318cf5) to head (71b55fe).

Files with missing lines Patch % Lines
studio/src/common/utils/item-loading.js 95.23% 19 Missing ⚠️
...tudio/src/translation/mas-collapsible-table-row.js 70.83% 7 Missing ⚠️
studio/src/common/components/mas-selected-items.js 90.90% 3 Missing ⚠️
...io/src/common/components/mas-select-items-table.js 96.29% 1 Missing ⚠️
studio/src/common/utils/render-utils.js 98.03% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #751      +/-   ##
==========================================
+ Coverage   87.32%   87.48%   +0.15%     
==========================================
  Files         209      214       +5     
  Lines       62510    63141     +631     
==========================================
+ Hits        54587    55238     +651     
+ Misses       7923     7903      -20     
Files with missing lines Coverage Δ
...io/src/common/components/mas-items-selector.css.js 100.00% <100.00%> (ø)
studio/src/common/components/mas-items-selector.js 100.00% <100.00%> (ø)
...rc/common/components/mas-search-and-filters.css.js 100.00% <ø> (ø)
...io/src/common/components/mas-search-and-filters.js 96.57% <100.00%> (ø)
...rc/common/components/mas-select-items-table.css.js 100.00% <100.00%> (ø)
...io/src/common/components/mas-selected-items.css.js 100.00% <100.00%> (ø)
studio/src/common/items-selection-store.js 100.00% <100.00%> (ø)
...src/common/styles/translation-common-styles.css.js 100.00% <100.00%> (ø)
studio/src/common/utils/item-loading-browser.js 100.00% <100.00%> (ø)
...tudio/src/common/utils/translation-items-loader.js 95.45% <100.00%> (ø)
... and 6 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0318cf5...71b55fe. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread studio/src/common/utils/item-loading.js
Comment thread studio/src/common/utils/item-loading.js
Copy link
Copy Markdown
Contributor

@honstar honstar left a comment

Choose a reason for hiding this comment

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

LGTM

@Andrei4226 Andrei4226 requested a review from honstar April 14, 2026 12:50
import { getService } from '../../utils.js';

const OFFER_DATA_CONCURRENCY_LIMIT = 5;
const VARIATIONS_CONCURRENCY_LIMIT = 5;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

item-loading.js exports processConcurrently and these same constants, but nothing in src/ imports from it yet — only its own test does. Is the plan to migrate translation-items-loader.js to use item-loading.js in a follow-up, or is item-loading.js intended for a different consumer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the plan is to migrate also translation-items-loader.js to use item-loading.js.
So it’s better to have it in this PR as well.
Now, translation-items-loader.js imports the shared helpers directly from item-loading.js.

import { CARD_MODEL_PATH, COLLECTION_MODEL_PATH, TABLE_TYPE } from '../../constants.js';
import { Fragment } from '../../aem/fragment.js';
import { getFragmentName } from '../../translation/translation-utils.js';
import { getService } from '../../utils.js';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The name translation-items-loader.js is translation-specific, and this file still imports getFragmentName from ../../translation/translation-utils.js. Moving it to common/ without generalizing it is the worst of both worlds — it either belongs back in translation/, or it needs to be renamed and have the translation-specific dependency inverted (e.g. accept a getDisplayName callback, as item-loading.js already does).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, you've right. I think it's better to rename it and have the translation‑specific dependency inverted.
So the getFragmentName import is removed. All functions now accept getDisplayName as a callback parameter, following the same pattern as item-loading.js.

async connectedCallback() {
super.connectedCallback();
setItemsSelectionStore(Store.translationProjects);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

setItemsSelectionStore is called in connectedCallback but never reset in disconnectedCallback. If a child component renders before this editor mounts (or after it disconnects), it will read from whatever store was last set. Worth either resetting on disconnect or documenting the assumed single-instance constraint.

Copy link
Copy Markdown
Contributor Author

@Andrei4226 Andrei4226 Apr 17, 2026

Choose a reason for hiding this comment

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

Very good point. Now, the previous store is saved on connect and restored on disconnect via #itemsSelectionStoreSnapshot.

* @param {AbortSignal} signal - Optional abort signal for cancellation
* @param {Number} timeoutMs - Timeout in milliseconds (default: 10000)
* @param {Number} timeoutMs - Timeout in milliseconds
* @returns {Promise<Object|null>} Offer data or null if not found/failed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The (default: 10000) annotation was dropped from the JSDoc. The default is still present in the function signature, but the doc hint was useful for callers — worth keeping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Restored the (default: 10000) annotation.

@Andrei4226 Andrei4226 requested a review from yesil April 17, 2026 09:27
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.

3 participants