linebender / linebender/druid

Data changed on mouseover even though data hasn't actually changed

Open
#1,409 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

Take a seat, because this is a weird one.

Reproduction case: https://gist.github.com/bheisler/cdc7af6256c74e6e40d181248ebeab21
Druid version: Current master branch
Platform: Windows (I don't _think_ that matters for this one, but because it's so weird I'm not sure)

Running this program brings up a window. Mousing over the window results in a stream of messages to stdout saying that a change was detected; these are printed by the ChangeDetectedController in response to `old_data.same(data)` returning false. That is to say, there's an update caused by every window event even though (as far as I can tell) nothing in this code can actually change the data.

Expected behavior: The data should not be changed by mousing over the window.

Now, let me dig into why this is weird. This doesn't _look_ like a minimal case, but it is. Just about every further reduction or change I can think of causes it to stop happening. A non-exhaustive list of things that cause this behavior to stop:
* Changing the inner type of UniqueId
* Removing the ThingId::Dummy variant (which is _not used in this code_)
* Changing the contents of the ThingId::Unique variant
* Removing or changing the type of _any_ of Thing's fields, even though they also are not used in this code, except to instantiate a Thing.
* Not adding a Thing to the ThingEditor::things Vector
* Changing the type of ThingEditor::things
* Replacing the List with a Label

I've attached a debugger and found that the `Vector::ptr_eq` check in the Data impl for Vector is returning false, even though the _contents_ of the vector are exactly the same.

I have _no idea_ why this is happening, but I minimized this case out of my recipe manager app - it is happening in my actual app, and I can't find a way to make it stop happening with my real code without removing real functionality. My app uses `old_data.same(new_data)` to trigger an auto-save, so this is actually causing me a real problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the linked gist on the current master branch and observe the mouseover output from ChangeDetectedController. Inspect the Data implementation for Vector, especially Vector::ptr_eq, and trace why old_data.same(data) reports a change; done means mouseover no longer reports changes when the vector contents are unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.