Skip to content

Conversation

@rhodges
Copy link
Member

@rhodges rhodges commented May 22, 2025

Fixes #32 -- adds a timeout before loading layers from hash. For Chrome on Windows, this was trying to build slider widgets before the parent elements were created.

@rhodges rhodges requested a review from Copilot May 22, 2025 22:36
@rhodges rhodges self-assigned this May 22, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the slider widget failure by introducing a timeout before layer activation to ensure that parent elements exist.

  • Adds a 200ms timeout in state.js to delay layer activation.
  • Improves error handling in models.js with extra conditions and a simplified slider redraw call.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
visualize/static/js/state.js Wraps layer activation in a setTimeout to fix widget initialization.
visualize/static/js/models.js Adds an extra condition to avoid errors and simplifies slider redraw logic.

rhodges added 2 commits May 22, 2025 15:54
… would likely fail for hashes with multiple layers
@rhodges rhodges requested a review from Copilot May 22, 2025 22:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes timing issues when restoring layers from the URL hash by delaying slider initialization, and tightens lookup guards and event binding logic in the layer model.

  • Adds a 200 ms timeout before activating hash state layers to ensure DOM readiness.
  • Adds an existence check for multilayerValueLookup entries and refactors slider callbacks.
  • Adjusts the animate-slider event binding condition to only bind once.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
visualize/static/js/state.js Wraps activateHashStateLayers loop in a 200 ms setTimeout.
visualize/static/js/models.js Guards against undefined lookup, binds drawSlider, updates .length check.

Copilot caught my off-by-one error.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rhodges rhodges merged commit f315c5d into main May 22, 2025
@rhodges rhodges deleted the 32_slider_widget_fails branch May 22, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider widget fails to load from shortened Link [v2.x]

1 participant