observe Job Changes
Observes job changes for a specific job with real-time updates and efficient change detection.
This method provides a reactive stream of job changes including:
Job Details: Real-time updates to job content, metadata, and associations
Status Updates: Changes to job status and status history
Assignments: Updates to assigned users and team changes
Customer Information: Changes to customer details and contact information
Assets and Products: Updates to associated assets and product configurations
Performance Features:
Efficient Change Detection: Only emits when actual changes occur, filtering out duplicate database events
Optimized JOINs: Uses comprehensive SQL queries to capture all related data in single database operations
Memory Efficient: Processes changes incrementally without loading unnecessary data
Offline-First Behavior:
Background Sync Trigger: Only emits events during background delta sync operations
Initial Sync Exclusion: Does NOT trigger during initial job fetching to avoid unnecessary events
Cached Data Updates: Emits when existing cached job data is updated from server
Usage Pattern:
zync.jobs.observeJobChanges(jobUid).collect { event ->
when (event) {
is JobChangeEvent.JobUpdated -> {
// Handle updated jobs: event.updatedJobs
// Handle deleted jobs: event.deletedJobUids
}
}
}Return
Flow of JobChangeEvent.JobUpdated containing actual changes to job data
Parameters
Unique identifier of the job to observe