/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/core-data/src/locks/selectors.js
38 строк
886 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { iterateDescendants, iteratePath, hasConflictingLock, getNode, } from './utils'; export function getPendingLockRequests( state ) { return state.requests; } export function isLockAvailable( state, store, path, { exclusive } ) { const storePath = [ store, ...path ]; const locks = state.tree; // Validate all parents and the node itself for ( const node of iteratePath( locks, storePath ) ) { if ( hasConflictingLock( { exclusive }, node.locks ) ) { return false; } } // iteratePath terminates early if path is unreachable, let's // re-fetch the node and check it exists in the tree. const node = getNode( locks, storePath ); if ( ! node ) { return true; } // Validate all nested nodes for ( const descendant of iterateDescendants( node ) ) { if ( hasConflictingLock( { exclusive }, descendant.locks ) ) { return false; } } return true; }