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

fix: user detail broken in demo (#59) #60

Merged
merged 7 commits into from
Dec 5, 2023

Conversation

Almas-Ali
Copy link
Contributor

As the issue #59 mentioned about the broken user detail page. I fixed the page and fixed the url from /more/{id} to /table/users/{id}. Now, It looks more relevant than /more route.

Hope it make sense.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

otherwise LGTM 👍.


@router.get('/users/{id}/', response_model=FastUI, response_model_exclude_none=True)
def user_profile(id: int) -> list[AnyComponent]:
users = [
Copy link
Member

Choose a reason for hiding this comment

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

please define these globally, then reuse them.

Copy link
Contributor Author

@Almas-Ali Almas-Ali Dec 4, 2023

Choose a reason for hiding this comment

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

I have resolved this and changed the class name MyTableRow to User for better understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

users: list[User] is now a global variable to access from everywhere.

return demo_page(
*tabs(),
c.Link(components=[c.Text(text='Back')], on_click=BackEvent()),
c.Details(data=user),
Copy link
Member

Choose a reason for hiding this comment

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

You need to add fields here so the data is rendered correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done adding fields here and also added in city details for better explicit controls.

Copy link
Member

Choose a reason for hiding this comment

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

i think there's no need on city as all the columns are simply text.

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #60 (9a02729) into main (ef70bed) will not change coverage.
The diff coverage is n/a.

❗ Current head 9a02729 differs from pull request most recent head 0819e38. Consider uploading reports for the commit 0819e38 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #60   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          120       120           
=========================================
  Hits           120       120           

@samuelcolvin
Copy link
Member

this is great, thanks so much.

@samuelcolvin samuelcolvin merged commit 0f577cd into pydantic:main Dec 5, 2023
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.

3 participants