Closed mQckingbird closed 8 years ago
Hi @injectless, if you can provide a test case to reproduce, that would be very helpful. It's difficult to say exactly what the cause of your crash was without details. Which adapter were you using? Are you sure it's because of pouchdb-upsert?
I tried to reproduce it but apparently it's not happening anymore, though I am not settled with this. I'm positive it will happen when I'm actually writing something I care about just to piss me off.
I still have a situation, where the bind takes place.
For each word you write, for each letter, PouchDB saves a revision. I really don't know if using upsert, which's creating a new revision every time you press a key, is a good idea.
I'm thinking of adding some sort of setTimeout(), but you probably have a better idea on how to handle this.
Look at the Value row.
PD: The app never crashed. My PC did, and not for any of this (:
Yeah, if you’re making a modification for every single keystroke, then I’m not surprised that it crashed. PouchDB is really not designed for that kind of workload.
Instead of setTimeout I would recommend using a debounce; lodash-debounce is a very good one.
Closing, please reopen if you still think this is a bug in pouchdb-upsert, cheers.
Nah, I'm sure it was my mistake. I'll reopen if I find anything weird about it. I leave this code here, in case it helps anyone:
Angular has debounce as standard.
ng-model-options="{ debounce: 500 }"
Or debouncing a function:
ngModel.editor.subscribe('editableInput', _.debounce(function (event, editable) {
ngModel.$setViewValue(editable.innerHTML.trim());
scope.save();
}, 500));
Scope will not be update until 500ms after the last keystroke. thanks!
Hi everyone! I'm using this script in an Electron App, for store HTML as the user is typing. Apparently, everything is OK,
But, a few minutes ago, I wrote a very long text, and my PC just frozen. Confident, I restarted and half the content was gone. Everything was/is working well, I'm just curious, this wasn't supposed to happen if the content is binded as type.
Do you recommend using this to achieve such functionality?