Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • Kotahi Kotahi
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 242
    • Issues 242
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 65
    • Merge requests 65
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • kotahi
  • KotahiKotahi
  • Issues
  • #921

Closed
Open
Created Jun 09, 2022 by Ben Whitmore@BenWhMaintainer

Page crash on creating new version of manuscript

To reproduce:

  1. Submit a manuscript
  2. In the decision page set to "Revise"
  3. Go back to the manuscript's submission page and click "Create new version". The page will crash.

The crash is caused because in Submit.js we have handleSave debounces set up like this, with useCallback inside a loop that iterates over all manuscript versions. So useCallback is called multiple times per render. This causes a page crash when an author creates a new version of a manuscript, because then it then has one extra version, so it encounters more hooks than during the previous render, and throws an error.

I'm not sure what the correct fix should be. The debounce needs to have its state preserved between calls, and we can't sensibly combine the debounces for all the different versions. But hooks such as useCallback shouldn't appear in conditional code or loops that can change order or count with subsequent renders.

Assignee
Assign to
Time tracking