Skip to content

Commit

Permalink
fix issue where filepond detach method was not called
Browse files Browse the repository at this point in the history
  • Loading branch information
rikschennink committed Aug 5, 2019
1 parent d3944e7 commit 094d600
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 5.1.3

- Fix FilePond detach handling


## 5.1.2

- Fix issue with 'input' event.
Expand Down
7 changes: 4 additions & 3 deletions dist/vue-filepond.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-filepond v5.1.2
* vue-filepond v5.1.3
* A handy FilePond adapter component for Vue
*
* Copyright (c) 2019 PQINA
Expand Down Expand Up @@ -185,14 +185,15 @@ export default (...plugins) => {
// clean up properly
const mutationHandler = (mutations, observer) => {
const removedNodes = (mutations[0] || {}).removedNodes || [];
if (!removedNodes[0] === this.$el) return;
const removedNode = removedNodes[0];
if (!removedNode || !removedNode.contains(this.$el)) return;
observer.disconnect();
detached.call(this);
}

// start observing parent element for changes to the DOM
const observer = new MutationObserver(mutationHandler);
observer.observe(this.$parent.$el, { childList: true })
observer.observe(document.documentElement, { childList: true, subtree: true });
},

// called when the component root node has been detached
Expand Down
7 changes: 4 additions & 3 deletions dist/vue-filepond.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-filepond v5.1.2
* vue-filepond v5.1.3
* A handy FilePond adapter component for Vue
*
* Copyright (c) 2019 PQINA
Expand Down Expand Up @@ -193,14 +193,15 @@
// clean up properly
var mutationHandler = function mutationHandler(mutations, observer) {
var removedNodes = (mutations[0] || {}).removedNodes || [];
if (!removedNodes[0] === _this2.$el) return;
var removedNode = removedNodes[0];
if (!removedNode || !removedNode.contains(_this2.$el)) return;
observer.disconnect();
detached.call(_this2);
};

// start observing parent element for changes to the DOM
var observer = new MutationObserver(mutationHandler);
observer.observe(this.$parent.$el, { childList: true });
observer.observe(document.documentElement, { childList: true, subtree: true });
},


Expand Down
4 changes: 2 additions & 2 deletions dist/vue-filepond.min.js

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

5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ export default (...plugins) => {
// clean up properly
const mutationHandler = (mutations, observer) => {
const removedNodes = (mutations[0] || {}).removedNodes || [];
if (!removedNodes[0] === this.$el) return;
const removedNode = removedNodes[0];
if (!removedNode || !removedNode.contains(this.$el)) return;
observer.disconnect();
detached.call(this);
}

// start observing parent element for changes to the DOM
const observer = new MutationObserver(mutationHandler);
observer.observe(this.$parent.$el, { childList: true })
observer.observe(document.documentElement, { childList: true, subtree: true });
},

// called when the component root node has been detached
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-filepond",
"version": "5.1.2",
"version": "5.1.3",
"description": "A handy FilePond adapter component for Vue",
"homepage": "https://pqina.nl/filepond",
"license": "MIT",
Expand Down

0 comments on commit 094d600

Please sign in to comment.