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.updater = new Updater(this, dictionary);
this.updateDisplayedWords();
} }
get dictionaryInfo () { get dictionaryInfo () {

View File

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

View File

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

View File

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