Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DarianGill
Copy link
Collaborator

What: Prevent's the possibility of a url hydration race while the app loads by disabling keyboard focus and mouse interaction with the navbar during state restoration from the url.

Why: As described in #92, clicking a navbar during state restoration led to a hydration race.

How:

  • New setNavInteractivity shiny and js functions
  • onFlushed listener in server.R triggers setNavInteractivity to disable nav bar until history is initialized
  • CSS classes that disable the nav bar client-side based on the setNavInteractivity parameters

Testing:

  • All 359 tests still pass and check() results in only notes

Copy link
Contributor

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 prevents a hydration race condition that could occur when users interact with the navigation bar during initial app state restoration from URL parameters. The fix disables navigation interactions until the app's history state is fully initialized.

Key changes:

  • Added JavaScript functions and CSS rules to disable/enable navbar interaction
  • Modified server-side logic to coordinate navbar state with URL history initialization
  • Enhanced history readiness checks throughout URL state synchronization code

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
R/ui.R Added JavaScript setNavbarDisabled function, custom message handler, and CSS rules to control navbar interactivity during initialization
R/server.R Added onFlushed callback to initially disable navbar; enhanced history initialization tracking; updated observers to respect history readiness before URL updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@regetz regetz self-requested a review November 13, 2025 01:06
Copy link
Collaborator

@regetz regetz left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@DarianGill DarianGill merged commit 1885b80 into develop Nov 13, 2025
@DarianGill DarianGill linked an issue Nov 13, 2025 that may be closed by this pull request
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.

Clicking new page during url state restore leads to circular updates

3 participants