Skip to content

Commit

Permalink
Issue qmk#274 Fix loading readme on importing keymap (qmk#275)
Browse files Browse the repository at this point in the history
Regression. Pre-vue upgrade the README would reload when importing a
keymap.json. This did not work anymore. Reported by @noroadsleft

 - change status/viewReadme to always clear status window
 - wait for viewReadme action to finish before setting keymapname and
 dirty flag
 - clean up loadingKeymapPromise slightly and cache it, remove it then
 execute the promise.
  • Loading branch information
yanfali authored Mar 12, 2019
1 parent 2f84b3f commit 9008138
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/ControllerBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ export default {
stats.count
} keycodes. Defined ${stats.any} Any key keycodes\n`;
store.commit('status/deferredMessage', msg);
store.commit('app/setKeymapName', data.keymap);
store.commit('keymap/setDirty');
store.dispatch('status/viewReadme', this.keyboard).then(() => {
store.commit('app/setKeymapName', data.keymap);
store.commit('keymap/setDirty');
});
});
disableOtherButtons();
});
Expand Down
3 changes: 2 additions & 1 deletion src/components/VisualKeymap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export default {
return [];
}
if (this.loadingKeymapPromise) {
this.loadingKeymapPromise();
const _promise = this.loadingKeymapPromise;
this.setLoadingKeymapPromise(undefined);
_promise();
}
// Calculate Max with given layout
// eslint-disable-next-line no-console
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const actions = {
.get(backend_readme_url_template({ keyboard: _keyboard }))
.then(result => {
if (result.status === 200) {
commit('clear');
commit('append', escape(result.data));
commit('append', escape(state.deferredMessage));
commit('deferredMessage', '');
Expand Down

0 comments on commit 9008138

Please sign in to comment.