---
title: "What conflict resolution strategies would you use during online sync?"  
description: "What conflict resolution strategies would you use during online sync?"  
author: "ICSM Computer"  
published: 2025-07-10  
updated: 2025-07-10  
canonical: https://www.mindstick.com/interview/34330/what-conflict-resolution-strategies-would-you-use-during-online-sync  
category: "IndexedDB"  
tags: ["database", "indexeddb"]  
reading_time: 5 minutes  

---

# What conflict resolution strategies would you use during online sync?

### What conflict resolution strategies would you use during online sync (e.g., server-wins vs client-wins)?

When implementing **conflict resolution strategies during online sync**, you typically choose based on the nature of your application, the data importance, and user expectations. Here are the most common strategies, with pros/cons and when to use them:

### 1. Server-Wins (Last-Write-Wins by server)

- **Description**: If there's a conflict, the server version overwrites the client's.
- **Use When**:

   - The server holds the authoritative source of truth.
   - Changes on the client are usually not critical or are derived from server data.

- **Example**: Stock market apps, CMS dashboards.
- **Pros**:

   - Simple and centralized.

- **Cons**:

   - Client-side edits may be lost silently.

### 2. Client-Wins

- **Description**: The client version is pushed and overrides the server’s version.
- **Use When**:

   - Offline-first apps where client changes are prioritized (e.g., personal notes, task apps).

- **Example**: To-do apps like Google Keep.
- **Pros**:

   - Feels responsive; user retains control.

- **Cons**:

   - Can overwrite critical server data accidentally.

### 3. Last-Write-Wins (Timestamp-Based)

- **Description**: Whichever update (client or server) is newest (based on timestamp) wins.
- **Use When**:

   - You trust both sides and track update times.

- **Pros**:

   - Automatic and simple.

- **Cons**:

   - Prone to time drift issues if client clock is incorrect.

### 4. Manual Merge (User-Assisted)

- **Description**: If conflict occurs, show both versions and let user choose or merge.
- **Use When**:

   - Data is sensitive or collaborative.

- **Example**: Document editing apps, CRM systems.
- **Pros**:

   - No accidental data loss.

- **Cons**:

   - Requires UI for conflict handling, and user effort.

### 5. Field-Level Merge

- **Description**: Only update specific fields that changed; merge non-conflicting fields.
- **Use When**:

   - Objects contain multiple independent fields (e.g., profile form: name, email, phone).

- **Pros**:

   - Minimizes conflicts.

- **Cons**:

   - More complex implementation.

### 6. Operational Transformation / CRDTs

- **Description**: Merge changes at the operation level (like in collaborative editors).
- **Use When**:

   - Real-time multi-user editing.

- **Example**: Google Docs, collaborative whiteboards.
- **Pros**:

   - Enables concurrent edits.

- **Cons**:

   - Complex to build and maintain.

### Recommended Hybrid Approach

In many real-world apps, a **hybrid approach** is best:

- Use **timestamp-based sync** for simple objects.
- Use **field-level merges** for form-based records.
- Fall back to **manual merge** when high-value data is at risk.
- Optionally allow configurable resolution policies (e.g., “Always prefer my device’s data”).

## Answers

### Answer by ICSM Computer

### What conflict resolution strategies would you use during online sync (e.g., server-wins vs client-wins)?

When implementing **conflict resolution strategies during online sync**, you typically choose based on the nature of your application, the data importance, and user expectations. Here are the most common strategies, with pros/cons and when to use them:

### 1. Server-Wins (Last-Write-Wins by server)

- **Description**: If there's a conflict, the server version overwrites the client's.
- **Use When**:

   - The server holds the authoritative source of truth.
   - Changes on the client are usually not critical or are derived from server data.

- **Example**: Stock market apps, CMS dashboards.
- **Pros**:

   - Simple and centralized.

- **Cons**:

   - Client-side edits may be lost silently.

### 2. Client-Wins

- **Description**: The client version is pushed and overrides the server’s version.
- **Use When**:

   - Offline-first apps where client changes are prioritized (e.g., personal notes, task apps).

- **Example**: To-do apps like Google Keep.
- **Pros**:

   - Feels responsive; user retains control.

- **Cons**:

   - Can overwrite critical server data accidentally.

### 3. Last-Write-Wins (Timestamp-Based)

- **Description**: Whichever update (client or server) is newest (based on timestamp) wins.
- **Use When**:

   - You trust both sides and track update times.

- **Pros**:

   - Automatic and simple.

- **Cons**:

   - Prone to time drift issues if client clock is incorrect.

### 4. Manual Merge (User-Assisted)

- **Description**: If conflict occurs, show both versions and let user choose or merge.
- **Use When**:

   - Data is sensitive or collaborative.

- **Example**: Document editing apps, CRM systems.
- **Pros**:

   - No accidental data loss.

- **Cons**:

   - Requires UI for conflict handling, and user effort.

### 5. Field-Level Merge

- **Description**: Only update specific fields that changed; merge non-conflicting fields.
- **Use When**:

   - Objects contain multiple independent fields (e.g., profile form: name, email, phone).

- **Pros**:

   - Minimizes conflicts.

- **Cons**:

   - More complex implementation.

### 6. Operational Transformation / CRDTs

- **Description**: Merge changes at the operation level (like in collaborative editors).
- **Use When**:

   - Real-time multi-user editing.

- **Example**: Google Docs, collaborative whiteboards.
- **Pros**:

   - Enables concurrent edits.

- **Cons**:

   - Complex to build and maintain.

### Recommended Hybrid Approach

In many real-world apps, a **hybrid approach** is best:

- Use **timestamp-based sync** for simple objects.
- Use **field-level merges** for form-based records.
- Fall back to **manual merge** when high-value data is at risk.
- Optionally allow configurable resolution policies (e.g., “Always prefer my device’s data”).


---

Original Source: https://www.mindstick.com/interview/34330/what-conflict-resolution-strategies-would-you-use-during-online-sync

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
