Components remembers


#1

Hello,
Just to tell you a small issue I had, maybe some others will.

I did a permission component which verified if an “obj” was editable by “user”.
The verification things were component’s method using self.obj and self.user.

I had big bugs with it :

Because component are instantiated at App(component=[MyComponent()]) time, all the views share the same MyComponent instance and then all the attributes states of MyComponent are shared across the views.
In another words Components are not reseted for each views.

Maybe it’s clear for many people but It wasn’t for me so I preferred to talk about it.

I wanted also to be sure it was the expected behaviour.

Finally I resolved this like that (juste shown to give an idea):

class MyPermission:
 def __init__(self,obj, user):
  self.user= user
  self.obj = obj
 def  __call__(self,,..):
  permissoin stuff her 

class MyPermissionComp:
  def resolve(balbla) - > MyPermission
      MyPermision(obj,user)()