Skip to content

Adding a new ally should no-op, if ally exists #68

@matildepark

Description

@matildepark

Scene had an issue where allying a new ship would set its reducer to undefined, causing subsequent searches to then send a duplicate ally poke by accident (tirrel-corp/scene#41). To be specific, this poke:

{
    app: 'treaty',
    mark: 'ally-update-0',
    json: {
      add: ship
    }
  };

When we send that duplicate poke, what we find is the following:

  1. We get an ini with an empty list of treaties for the ally.
  2. In Dojo, we see a crash because the subscription already exists.
  3. On subsequent visits on any client (Scene, Grid, whatever), looking up treaties from the ally results in our ship dutifully saying there are no apps available, because we have the ally stored with an empty treaty list in state.

This is what I would expect if the poke itself results in treaty.hoon setting an empty list of treaties for that ally alongside the subscription request. What should happen is that if the ally is already in state, we ignore the poke.

Likewise, I'm not sure what the workaround is for people who have run into this already. Can we just nuke it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions