mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
feat: Enhance validation viewing functionality with event emission
- Updated the `createMarkViewedHandler` to emit an event when a validation is marked as viewed, allowing the UI to update the unviewed count dynamically. - Modified the `useUnviewedValidations` hook to handle the new event type for decrementing the unviewed validations count. - Introduced a new event type `issue_validation_viewed` in the issue validation event type definition for better event handling.
This commit is contained in:
@@ -45,7 +45,11 @@ export function useUnviewedValidations(currentProject: Project | null) {
|
||||
const unsubscribe = api.github.onValidationEvent((event) => {
|
||||
if (event.projectPath === currentProject.path) {
|
||||
if (event.type === 'issue_validation_complete') {
|
||||
// New validation completed - increment count
|
||||
setCount((prev) => prev + 1);
|
||||
} else if (event.type === 'issue_validation_viewed') {
|
||||
// Validation was viewed - decrement count
|
||||
setCount((prev) => Math.max(0, prev - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user