Skip to content

Commit

Permalink
ULMS-1251 Fixed listener dropping for LockProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkonst committed Apr 19, 2021
1 parent 4b376c2 commit 71883f3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/components",
"version": "1.4.0",
"version": "1.4.1",
"description": "UI components library",
"homepage": "https://github.com/netology-group/ulms-media-ui",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/drawing/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/drawing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/ui-drawing",
"version": "1.1.2",
"version": "1.1.3",
"description": "",
"keywords": [
"lerna"
Expand Down
2 changes: 2 additions & 0 deletions packages/drawing/src/drawing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ export class Drawing extends React.Component {
}

if (this.__lockProvider) {
this.__lockProvider.removeUpdateListener()

this.__lockProvider = null
}

Expand Down
4 changes: 4 additions & 0 deletions packages/drawing/src/lock-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class LockProvider {
this.listener = fn
}

removeUpdateListener () {
this.listener = undefined
}

_updated (prev, next) {
if (this.listener) {
const changed = Boolean(!prev.length && next.length)
Expand Down
4 changes: 4 additions & 0 deletions packages/drawing/src/lock-provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ describe('LockProvider', () => {
provider.labels(['label_1', 'label_3'])

expect(provider.isLocked('label_3')).toBe(true)

provider.removeUpdateListener()

expect(provider.listener).toBe(undefined)
})
})

0 comments on commit 71883f3

Please sign in to comment.