Coder Social home page Coder Social logo

Comments (4)

bbrks avatar bbrks commented on August 15, 2024 1

Sorry if you ran into this! It's a rough part of the app

Not to worry. I only encountered this because I was intentionally causing conflicts to see how it handled the situation. I've been bitten by other note taking apps that simply drop one set of changes/last writer wins.

The only situation I'd imagine I would run into conflicts in the real world would be if I have an offline locally-running wiki, and I want to make some changes to it, but upstream has since updated.
Editable offline notes are something I'd want to have, but not something I'd use super often, so being a sharp edge is entirely reasonable.
I agree that those 2 steps of improved formatting, and throwing errors back up to the UI would be more than sufficient to put the onus on the user to resolve.

from deadwiki.

xvxx avatar xvxx commented on August 15, 2024 1

Okay, I've added the start of this: if your wiki page has git conflict syntax in it, you'll get dropped into the editor with a message:

image

I think for the second part I'll add a /conflicts page that will just grep all your pages and list any that have conflicts in them. In the future when we get more fancy we might be able to do a notification in the UI or something, but I think this will at least be better than nothing for now.

from deadwiki.

xvxx avatar xvxx commented on August 15, 2024

Sorry if you ran into this! It's a rough part of the app. The whole thing is pretty much a proof-of-concept at this point, but I'm working on refactoring in the vial branch and will be merging that soon.

This is preferable to losing the data on either side, but nothing in the logs or UI indicate a conflict has happened, and the rendering of a markdown file containing merge conflicts is kinda broken.

I think in the short term, solving these issues you've identified would give the user the necessary tools to fix the conflict:

  1. Show an error in the web UI when syncing fails.

  2. Render the merge conflict differently than a regular wiki page and resolve it when you submit changes.

The error could be displayed wiki-wide for any errors generated while syncing, so you'd at least know something happened. Could double for showing you network issues and whatnot, too.

The conflict page could just show plaintext, or launch you right into the editor with a message printed above it.

(Of course, multi-file conflicts might be a bigger problem...)

In the longer term for merge conflicts, I've mostly been thinking about how to avoid them. At least, in common cases. Since this is a single player wiki, I've been planning to add two explicit sync points:

  1. When you load a page, sync if the last sync was more than SYNC_TIME ago. The goal being you're always working with the latest version of the wiki data.

  2. When you edit or create a page, sync immediately. The remote should always have the latest version, too.

The idea with these two is that the user is probably bouncing between a few different computers running deadwiki, so submit any changes as soon as they make them and pull changes as soon as they begin a new "session."

Beyond that, I was going to add the SHA to the edit <form> and compare it against the SHA when you submit, to prevent overwriting newer data.

But I am open to all ideas. I want to keep the act of creating and editing wiki pages extremely fast, so I don't want to put a git pull in the middle of that flow specifically, but I do think it makes sense to kick off a sync right away and then display an error if it failed.

from deadwiki.

xvxx avatar xvxx commented on August 15, 2024

The offline scenario is a good one, I’ll make sure to test that out. I’m going to leave this open until it’s tackled.

from deadwiki.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.