kroo / reflex-clerk

A reflex custom component library for clerk
20 stars 10 forks source link

Possibly n00b question #15

Closed vineetbansal closed 3 months ago

vineetbansal commented 3 months ago

Hello - I'd like to persist some data in Reflex and associate it with the currently-logged-in clerk user. I'm able to see clerk.ClerkState.user.id when I add it to an rx.Component, but cannot seem to retrieve it using clerk.ClerkState.user, which gives me a BaseVar, even if I trigger the code in an event handler (on on_submit handler of a rx.form.root element).

I suspect this is my lack of knowledge of how BaseVars work in Reflex, but I'm stumped on how to proceed. I'm able to access the realized (string) value of a sample BaseVar attribute in the State object where I'm trying to do all this, but don't know how to ask clerk.ClerkState to programmatically give me the user id of the logged-in user.

I'd really appreciate any pointers here.

vineetbansal commented 3 months ago

hmm - if my State class inherits from clerk.ClerkState then I can access self.user_id. .

vineetbansal commented 3 months ago

NVM - I should have read the section on Substates before I opened this "issue". Sorry for the noise!