Skip to content

Repeated non-CORS filter blocking overwrites the original disabled state #574

Open

Description

@coderabbitai

Summary

In Diva 7.5.2, setFilterAccessBlocked(true) overwrites each control's saved disabled state on every call. A second blocked call saves the already-forced disabled = true state. Unblocking then leaves previously enabled filter controls and Save view disabled.

Reported by request of @ahankinson while reviewing the vendored Diva update in Cantus. This issue belongs upstream, outside the scope of the Cantus OMR highlighting changes.

Affected area

src/diva.ts, method setFilterAccessBlocked, including both the .diva-modal-sidebar controls and the Save view button.

applyFilterPreview calls this method when the filter source changes. closeFilterPreview also calls it to restore access.

Reproduction

  1. Use Page View with static images loaded without CORS.
  2. Move between two non-CORS static pages so that setFilterAccessBlocked(true) runs twice on the same controls.
  3. Switch to a CORS-enabled page, or close the filter preview so that setFilterAccessBlocked(false) runs.
  4. Check whether controls that were originally enabled remain disabled.

The state overwrite follows directly from the vendored implementation. The browser reproduction has not been run.

Required change

Save the original disabled state only when dataset.divaFilterWasDisabled is undefined. Apply this guard to both the sidebar controls and the Save view button. Continue forcing controls to disabled while blocked. On unblocking, restore the saved state and remove the saved marker.

Acceptance criteria

  • Repeated blocked calls preserve the original disabled state.
  • Unblocking restores originally enabled controls to enabled.
  • Originally disabled controls remain disabled.
  • Save view follows the same rules.
  • Regression coverage includes repeated blocking followed by unblocking.

Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions