You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the "store.commit" method, I get an error before the getter function is called.
This is preventing me from having complex setters in the store.
Example app to demonstrate
from vue import VueComponent, VueStore, mutation
class Store(VueStore):
test_value = 1
@mutation
def increment_test_value(self, value):
print('increment')
self.test_value += value
class App(VueComponent):
template = '''
<div>
<button @click="set_value">{{ value }}</button>
</div>
'''
def set_value(self, event):
self.store.commit('increment_test_value', 1)
@computed
def value(self):
return self.store.test_value
App("#app", store=Store())
html
<body>
<div id="app"></div>
</body>
Output:
Error
at Object._b_.AttributeError.$factory (eval at $make_exc (brython.min.js:7), <anonymous>:1:2566)
at $B.JSObj.__getattribute__ (brython.min.js:7)
at Object.$B.$getattr (brython.min.js:7)
at wrapper275 (eval at run_py (brython.min.js:7), <anonymous>:165:296)
at s.wrapper63 (eval at run_py (brython.min.js:7), <anonymous>:308:185)
at s.<anonymous> (brython.min.js:7)
at vuex.min.js:6
at vuex.min.js:6
at Array.forEach (<anonymous>)
at vuex.min.js:6
brython.min.js:7 Traceback (most recent call last):
File /static/vue/decorators/base.py line 32, in set_value
return Object.to_js(fn(*args, **kwargs))
File /static/test/app.py line 21, in set_value
self.store.commit('increment_test_value', 1)
File /static/vue/bridge/vuex_instance.py line 42, in commit
self.__commit__(mutation_name, {"args": args, "kwargs": kwargs})
File /static/vue/decorators/base.py line 32, in wrapper
return Object.to_js(fn(*args, **kwargs))
File /static/vue/decorators/mutation.py line 19, in wrapper
)
brython.min.js:7 AttributeError: get
brython.min.js:7 error Error
at Object._b_.AttributeError.$factory (eval at $make_exc (brython.min.js:7), <anonymous>:1:2566)
at $B.JSObj.__getattribute__ (brython.min.js:7)
at Object.$B.$getattr (brython.min.js:7)
at wrapper275 (eval at run_py (brython.min.js:7), <anonymous>:165:296)
at s.wrapper63 (eval at run_py (brython.min.js:7), <anonymous>:308:185)
at s.<anonymous> (brython.min.js:7)
at vuex.min.js:6
at vuex.min.js:6
at Array.forEach (<anonymous>)
at vuex.min.js:6
brython.min.js:7 attribute commit of self s {_committing: true, _actions: {…}, _actionSubscribers: Array(0), _mutations: {…}, _wrappedGetters: {…}, …} ƒ (t,e,n){return u.call(i,t,e,n)} (2) ['increment_test_value', {…}] Arguments(2) ['increment_test_value', {…}, callee: ƒ, Symbol(Symbol.iterator): ƒ]
brython.min.js:7 Error
at Object._b_.AttributeError.$factory (eval at $make_exc (brython.min.js:7), <anonymous>:1:2566)
at $B.JSObj.__getattribute__ (brython.min.js:7)
at Object.$B.$getattr (brython.min.js:7)
at wrapper275 (eval at run_py (brython.min.js:7), <anonymous>:165:296)
at s.wrapper63 (eval at run_py (brython.min.js:7), <anonymous>:308:185)
at s.<anonymous> (brython.min.js:7)
at vuex.min.js:6
at vuex.min.js:6
at Array.forEach (<anonymous>)
at vuex.min.js:6
brython.min.js:7 Traceback (most recent call last):
File /static/vue/decorators/base.py line 32, in set_value
return Object.to_js(fn(*args, **kwargs))
File /static/test/app.py line 21, in set_value
self.store.commit('increment_test_value', 1)
File /static/vue/bridge/vuex_instance.py line 42, in commit
self.__commit__(mutation_name, {"args": args, "kwargs": kwargs})
File /static/vue/decorators/base.py line 32, in wrapper
return Object.to_js(fn(*args, **kwargs))
File /static/vue/decorators/mutation.py line 19, in wrapper
)
brython.min.js:7 AttributeError: get
vue.min.js:6 Error
at Object._b_.AttributeError.$factory (eval at $make_exc (brython.min.js:7), <anonymous>:1:2566)
at $B.JSObj.__getattribute__ (brython.min.js:7)
at Object.$B.$getattr (brython.min.js:7)
at wrapper275 (eval at run_py (brython.min.js:7), <anonymous>:165:296)
at s.wrapper63 (eval at run_py (brython.min.js:7), <anonymous>:308:185)
at s.<anonymous> (brython.min.js:7)
at vuex.min.js:6
at vuex.min.js:6
at Array.forEach (<anonymous>)
at vuex.min.js:6
The text was updated successfully, but these errors were encountered:
Again, I tried to cut down a minimal example and did it wrong =P.
You're correct in that the code works with computed imported.
I do however see (with bython 3.10.6):
empty stack
increment
empty stack
This "empty stack" I'm seeing in other callbacks in Vue.js libraries.
I'll close this and open another issue as this seems to be the cause of an issue when using vue-socketio.
When using the "store.commit" method, I get an error before the
getter
function is called.This is preventing me from having complex setters in the store.
Example app to demonstrate
html
Output:
The text was updated successfully, but these errors were encountered: