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

Subject dimensions are stored repeatedly in classification object #5951

Open
1 task done
goplayoutside3 opened this issue Mar 4, 2024 · 0 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@goplayoutside3
Copy link
Contributor

goplayoutside3 commented Mar 4, 2024

Package

Choose from the list:

  • lib-classifier

Describe the bug

Note that this was first reported in Daily Minor Planet. @lcjohnso Slack thread https://zooniverse.slack.com/archives/C0DTP3L2K/p1709678226020949.

The classifier's SubjectViewerStore records subject dimensions (clientHeight, clientWidth, naturalHeight, naturalWidth) whenever a subject image is loaded. It happens here:

onSubjectReady (event) {
const { target = {} } = event || {}
const {
clientHeight = 0,
clientWidth = 0,
naturalHeight = 0,
naturalWidth = 0
} = target || {}
self.dimensions.push({ clientHeight, clientWidth, naturalHeight, naturalWidth })
self.rotation = 0
self.loadingState = asyncStates.success
},

However, since dimensions are pushed into an array, a new record of dimensions is added every time a multi-frame viewer switches frames (flipbook, text + image viewer, multiframe viewer for transcriptions). Because frame is also in the SubjectViewerStore, it updates and triggers a component re-render including a call of onSubjectReady() again and again.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a multi-frame subject workflow such as this test transcription project
  2. This test flipbook project is also an option Fixed
  3. Switch between frames in the viewer
  4. Submit a classification
  5. Inspect the classification object in the console. You'll see multiple recorded metadata.subject_dimensions like this:
Screenshot 2024-03-04 at 5 24 51 PM

Expected behavior

There should only be one record of dimensions per subject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant