Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add back sales app #221

Merged
merged 3 commits into from
Apr 10, 2024
Merged

add back sales app #221

merged 3 commits into from
Apr 10, 2024

Conversation

martinxu9
Copy link
Contributor

@martinxu9 martinxu9 commented Apr 9, 2024

deployed here: https://sales.staging.reflexcorp.run/, will redeploy to prod for the gallery

@martinxu9 martinxu9 requested review from masenf and Lendemor April 9, 2024 22:22
Comment on lines 149 to 153
@rx.var
def get_users(self) -> list[Customer]:
"""Get all users from the database."""
with rx.session() as session:
return session.exec(select(Customer)).all()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should make this an on_load

Suggested change
@rx.var
def get_users(self) -> list[Customer]:
"""Get all users from the database."""
with rx.session() as session:
return session.exec(select(Customer)).all()
def get_users(self) -> list[Customer]:
"""Get all users from the database."""
with rx.session() as session:
self.users = session.exec(select(Customer)).all()

Then update add_customer and delete_customer to call this afterwards. And have the / route call it on_load.

This tends to be better for data apps, because it avoids database queries on every action, and allows the app to export without a database defined (which is why the CI is failing)

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@martinxu9 martinxu9 merged commit 8ffaff6 into main Apr 10, 2024
19 checks passed
@martinxu9 martinxu9 deleted the mx/add-back-sales branch April 10, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants