Skip to content

Panel warns and refuses to run in files with over 10K anchors #3

@Inventsable

Description

@Inventsable

The panel will generate a ScriptUI modal warning a user when they attempt to run it in a file with over 10K anchors. The reasoning for this is because scripting is synchronous and will attempt to run in sequence -- in large operations, this can appear to freeze or make the app unresponsive, and it may take a while for the script to go through such large numbers. Even if it creates an anchor every 5ms (200 per second) this can still seemingly lock the app or freeze it, and for now is intentional. If we attempt to run all 10K anchors in one sitting, the panel has to wait for scripting to finish the entire list and it can't receive any input from the user until the script finishes.

The solution would be:

  • A diagnostic is ran pre-script which collects the UUIDs of all pageItem existing in the document
  • Instead of processing the entire file in one sequence, the panel will break the list up into more easily digestible sections, something like 1K maximum per script execution
  • The panel then runs through these "chunks" of pageItems one by one and asynchronously, allowing the user to attempt to cancel midway through

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions