Skip to content

Commit

Permalink
fixed restriction on features
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHalwax committed Jul 31, 2024
1 parent 89b3d5e commit 5e129b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/renderer/model/sources/lockedTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export const lockedTracker = (source, store) => {
const unlocked = key => !keySet.has(key)

;(async () => {
store.on('batch', ({ operations }) => {
store.on('batch', async ({ operations }) => {
const candidates = operations
.filter(({ key }) => ID.isLockedId(key))
.filter(({ key }) => (ID.isLockedId(key) || ID.isRestrictedId(key)))
.map(({ type, key }) => ({ type, key: ID.associatedId(key) }))


const [additions, removals] = R.partition(({ type }) => type === 'put', candidates)
additions.forEach(({ key }) => keySet.add(key))
removals.forEach(({ key }) => keySet.delete(key))
Expand All @@ -25,7 +26,9 @@ export const lockedTracker = (source, store) => {
source.dispatchEvent(new TouchFeaturesEvent(keys))
})

const keys = await store.keys(ID.lockedId())
const lockedKeys = await store.keys(ID.lockedId())
const restrictedKeys = await store.keys(ID.restrictedId())
const keys = [...lockedKeys, ...restrictedKeys]
keys.forEach(key => keySet.add(ID.associatedId(key)))
})()

Expand Down

0 comments on commit 5e129b1

Please sign in to comment.