-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
refactor(backend,taxonomy-editor-frontend): Handle background task on frontend #316
Conversation
Link: #304 (comment) needs to be merged prior to this PR for correct functionality. Remarks:
This results in the page loading indefinitely if the user tries to access existing projects while a new project is being created, as the backend cannot respond to the frontend until parsing is complete. The synchronicity of these functions appears to be causing the backend's inability to respond to the frontend. Converting them to asynchronous operations might be necessary to resolve this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Small improvement proposed.
backend/editor/entries.py
Outdated
async with TransactionCtx(): | ||
await self.set_project_status(status="FAILED") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could set project status FAILED only if create_project did not fail ? (create project could return created project and you could test it here, remember to create the variable with None
before the try
though to be sure it exists.
1f9c964
to
88350fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @Piv94165 !
There are still a bit of things to improve.
@@ -29,22 +29,30 @@ const GoToProject = ({ clearNavBarLinks }: Props) => { | |||
const navigate = useNavigate(); | |||
|
|||
const { data, isPending, isError } = useFetch<ProjectsAPIResponse>( | |||
`${API_URL}projects?status=OPEN` | |||
`${API_URL}projects` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, in another PR I think we will have to provide a way to filter by status !
@Piv94165 should we close this PR ? If I remember well you merged those changes in another PR right ? |
Current situation
To be done
These enhancements will offer a more comprehensive view of project statuses, provide clarity to users during parsing, and ensure visibility of all projects in the list, even if parsing fails or takes longer than expected.
Screenshot
A small text reminds user to reload the page to see taxonomy
In the list, the project status is displayed.
Not only the open projects are listed but also the other ones.
Part of
(https://github.com/orgs/openfoodfacts/projects/103/views/1?pane=issue&itemId=46878339)