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

Fixed showing annotations at 0 frame #7796

Merged
merged 4 commits into from
Apr 25, 2024
Merged

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Apr 23, 2024

Motivation and context

After the PR #7714 annotations are not loaded to the store with GET_JOB_SUCCESS action, instead we load them in separate async action fetchAnnotationsAsync.
That leads to the problem: CanvasWrapper component is initially mounted with empty annotations array. That leads to such function calls: updateCanvas -> canvasInstance.setup -> the promise is created that will set this.data.objects to empty array.
Then the annotations are put to the store, CanvasWrapper runs update hook, where the chain is called again: updateCanvas -> canvasInstance.setup -> but instead of promise, the objects are assigned right away. After that when the first promise will be executed the objects will be empty which leads to empty canvas wihout annotations.

This PR fixes the problem by introducing initialized state status for annotations so CanvasWrapper is not mounted before annotations are loaded. (+it removes one unnecessary re-render)

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@klakhov klakhov requested a review from bsekachev as a code owner April 23, 2024 11:22
@klakhov klakhov requested a review from nmanovic as a code owner April 23, 2024 11:24
@klakhov klakhov removed the request for review from nmanovic April 23, 2024 11:24
@klakhov klakhov added the ui/ux label Apr 23, 2024
@bsekachev bsekachev merged commit 2915bdd into develop Apr 25, 2024
32 checks passed
@cvat-bot cvat-bot bot mentioned this pull request Apr 26, 2024
@bsekachev bsekachev deleted the kl/fix-missing-annotations branch May 6, 2024 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants