Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Navigation editor] Save menu items using the REST API (#34541)
* Remove tests * Validate if menu_order is set and >= 1 * First stab at saving menu items using the REST API * Migrate batch save to async thunks using REST API calls * simplify the logic * Simplify computeDeletedMenuItemIds * Use more generic variable names * Use more consistent variable names * Update the data flow to ensure API receives appropriate parameters names * Alter the order of arguments in blockToMenuItem * Move transformations to transform.js * Remove dev comment * Operate on lists and sets, not on trees * Extract batchSaveMenuItems * Inline blockIdToOldEntityRecord * Ensure consistency between stored menu items and the ones recovered from the block attributes * Add error checking * Add generic batchSaveDiff function * Preprocess menu data before sending it over to the API * Adjust unit tests * Remove dev artifacts * Replace map/filter with a for loop for readability * Rename "new" to Desired" to avoid abiguity * Rename tasks and diffs to changesets * Remove prePersistMenuItem * Don't await releaseStoreLock * Inline resolveSelectMenuItems * Resolve a list of all menu items prior to creating placeholder menu items. * Remove async code from the synchronous getDesiredMenuItems selector * Don't await createErrorNotice and createSuccessNotice * Rename computeChangeset to prepareChangeset and remove awaits from it and getFailedChanges * Use store object to refer to core-data store, not a string identifier * Set placeholder menu order to 1 * Don't create placeholder menu items for non-link blocks * Remove menu order validation * Remove menu id validation * Restore rest_invalid_param validation error code * Fix unit tests * Add comments blocks * Remove "@todo: extract locks to a separate package?" * Remove unused block argument from createPlaceholderMenuItem * Remove obsolete "block" argument * Replace diff() with _.difference() * Replace clientId mapping with internal attribute denoting entity record ID * Radically simplify batch saving * Fix unit tests * Translate Menu item title * Remove obsolete imports * Switch to using immutable data structures * Add doc blocks * Add a test for default 'menu-item-type' * Restore newline * Lint * Use isBlockSupportedInNav in blockToMenuItem * Lint * Code style: Collapse two filters into one * Inline applyEdits Co-authored-by: Jonny Harris <jon@spacedmonkey.co.uk>
- Loading branch information