Skip to content

Conversation

@ishika021
Copy link

This PR makes a few small, I've focused on improvements to the units/tasks state to improve robustness and avoid subtle edge-case bugs.

1. Safer handling of missing taskKey URL parameter

  • Previously, taskKey from the URL was always passed into taskKeyFromString, even when it was undefined. This could lead to unexpected parsing behaviour on direct navigation or initial page load.
  • Now, the code explicitly checks for the presence of taskKey and resets the selected task when it is missing.

2. Prevent redundant $state.go calls

  • Updating the URL for the selected task previously triggered $state.go even when the taskKey hadn’t changed. This could cause unnecessary digest cycles and state churn.
  • The update now short-circuits when the URL already reflects the current task selection.

3. More precise prevention of unnecessary state reloads

  • The preventDefault logic on state changes has been tightened to only block transitions when the state, unit, and task key are all unchanged. This avoids accidentally blocking legitimate navigation where only the task selection changes.

4. Minor cleanup for clarity

Small refactors were made to simplify task key assignment and ensure consistent string handling of URL parameters, without changing user-facing behaviour.

These changes are intentionally small and non-functional, and are intended to improve stability, readability, and maintainability of the existing task state logic.

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.

1 participant