Skip to content

Commit

Permalink
chore - fix naming issue with action
Browse files Browse the repository at this point in the history
 - rename deferredMessage() to setDeferredMessage
 - initialize pinia for electron (probably should delete this code)
   - this fixes the electron based cypress test failures
  • Loading branch information
yanfali committed Oct 23, 2024
1 parent 3504ac3 commit 185c261
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/ControllerBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default {
...mapActions('keymap', ['load_converted_keymap']),
...pinia.mapActions(useStatusStore, [
'viewReadme',
'deferredMessage',
'setDeferredMessage',
'append',
'clearStatus'
]),
Expand Down Expand Up @@ -402,7 +402,7 @@ export default {
msg = `${msg}\n${stats.warnings.join('\n')}`;
msg = `${msg}\n${stats.errors.join('\n')}`;
}
this.deferredMessage(msg);
this.setDeferredMessage(msg);
this.viewReadme(this.keyboard).then(() => {
let keymapName = data.keymap;
if (keymapName.endsWith('.json')) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ControllerTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default {
...mapActions('keymap', ['initTemplates', 'load_converted_keymap']),
...pinia.mapActions(useStatusStore, [
'append',
'deferredMessage',
'setDeferredMessage',
'clearStatus',
'viewReadme'
]),
Expand Down Expand Up @@ -292,7 +292,7 @@ export default {
// and switching keyboards. This entire flow needs redesigning as it was written
// when I had a poor understanding of vue observability.
this.append(msg);
this.deferredMessage(msg);
this.setDeferredMessage(msg);
}
});
return promise;
Expand Down
4 changes: 3 additions & 1 deletion src/electron.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import store from './store';
import store, { pinia } from './store';
import { setActivePinia } from 'pinia';
import { useStatusStore } from './store/status';

export default {
init() {
//We use the Bridge as a way to share functions between electron and vue
setActivePinia(pinia); // quite possibly a dirty hack
const statusStore = useStatusStore();
if (window.Bridge) {
store.commit('app/enableElectron');
Expand Down
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ if (
isObject(navigator) &&
isString(navigator.userAgent) &&
navigator.userAgent.includes('Electron')
)
) {
electron.init(); // initializes code specific for the electron app
}

Vue.component('VeilComponent', Veil);
Vue.component('VSelect', vSelect);
Expand Down
2 changes: 1 addition & 1 deletion src/store/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useStatusStore = defineStore('status', {
* Add a deferred message to be appended to end of message buffer at render time.
* @param {string} dmsg - a deferred message
*/
deferredMessage(dmsg) {
setDeferredMessage(dmsg) {
this.deferredMessage = dmsg;
},
/**
Expand Down

0 comments on commit 185c261

Please sign in to comment.