refactor: multiple fixes and improvements#43
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new ElectionContext to centralize election data management and computed values, refactoring components to consume this shared state instead of maintaining their own local state or making redundant API calls. The changes improve data consistency, reduce code duplication, and establish a single source of truth for election-related information.
Key changes:
- Added
ElectionProviderwith auto-refreshing election data and computed values for status, timing, and vote counts - Refactored
ProcessProviderto consume election data fromElectionContextwhen available - Updated multiple components to use centralized election state instead of local state management
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/VotePage.tsx | Wrapped the vote page with ElectionProvider to provide election context |
| src/contexts/election-context.tsx | New context provider managing election state, polling, and computed values |
| src/contexts/process-context.tsx | Modified to consume and use election data from ElectionContext |
| src/components/vote-parameters.tsx | Removed local state management, now uses useElection hook for status and timing |
| src/components/vote-display.tsx | Replaced local process queries and state with useElection hook, added voting method lookup map |
| src/components/vote-actions.tsx | Updated to use election status values from useElection hook |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🚀 Deployed on https://691b5e9cd80ce4214d607f64--davinci-ui.netlify.app |
…no results yet refs #42
afa0189 to
103cd43
Compare
This was referenced Nov 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs #42