Browse Source

added debounce

ryuichi-e 5 years ago
parent
commit
6e9ee4a17a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/client/js/components/PageEditor/LinkEditModal.jsx

+ 3 - 1
src/client/js/components/PageEditor/LinkEditModal.jsx

@@ -8,6 +8,8 @@ import {
   ModalFooter,
   ModalFooter,
 } from 'reactstrap';
 } from 'reactstrap';
 
 
+import { debounce } from 'throttle-debounce';
+
 import path from 'path';
 import path from 'path';
 import Preview from './Preview';
 import Preview from './Preview';
 
 
@@ -48,7 +50,7 @@ class LinkEditModal extends React.PureComponent {
     this.toggleIsUsePamanentLink = this.toggleIsUsePamanentLink.bind(this);
     this.toggleIsUsePamanentLink = this.toggleIsUsePamanentLink.bind(this);
     this.save = this.save.bind(this);
     this.save = this.save.bind(this);
     this.generateLink = this.generateLink.bind(this);
     this.generateLink = this.generateLink.bind(this);
-    this.getPreview = this.getPreview.bind(this);
+    this.getPreview = debounce(1000, this.getPreview.bind(this));
     this.renderPreview = this.renderPreview.bind(this);
     this.renderPreview = this.renderPreview.bind(this);
     this.getRootPath = this.getRootPath.bind(this);
     this.getRootPath = this.getRootPath.bind(this);
   }
   }