Update to allow displaying words after loading

This commit is contained in:
Robbie Antenesse 2017-11-15 11:00:04 -07:00
parent f5a558e68e
commit 3f7444de62
4 changed files with 16 additions and 11 deletions

View File

@ -35,6 +35,8 @@ class App extends Component {
}
this.updater = new Updater(this, dictionary);
this.updateDisplayedWords();
}
get dictionaryInfo () {

View File

@ -40,21 +40,22 @@ class DictionaryData {
constructor () {
this.default = defaultDictionary;
if (['emptydb', 'donotsave'].includes(process.env.NODE_ENV)) {
if (['emptydetails', 'donotsave'].includes(process.env.NODE_ENV)) {
store.remove('Lexiconga');
}
if (!store.get('Lexiconga')) {
store.set('Lexiconga', defaultDictionary);
} else {
const largestId = wordDb.words
.orderBy('id').reverse()
.first((word) => {
return word.id;
});
idManager.setId('word', ++largestId);
console.log('First word ID: ' + idManager.next('word').toString());
wordDb.words
.orderBy('id').reverse()
.first((word) => {
return parseInt(word.id);
})
.then(largestId => {
idManager.setId('word', ++largestId);
console.log('First word ID: ' + idManager.next('word').toString());
});
}
}

View File

@ -5,7 +5,7 @@ class IDManager {
// Add IDs here as needed.
}
setID (id, value) {
setId (id, value) {
this[id] = value;
}

View File

@ -4,7 +4,7 @@
// 'emptydetails' to clear the dictionary details on each load.
// 'emptydb' to clear the database on each load.
// 'development' to not do anything special.
const BUILDMODE = 'donotsave';
const BUILDMODE = 'development';
const webpack = require('webpack');
const path = require('path');
@ -132,6 +132,8 @@ if (BUILDMODE === 'production') {
);
webpackConfig.devtool = 'hidden-source-map';
} else {
webpackConfig.devtool = 'source-map';
}
module.exports = webpackConfig;