donejs / donejs/bitballs

Race issue in bitballs

Open
#329 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12
Forks
18
PR merge metrics
No merged PRs in 30d

Description

In bitballs, there's a `` two-way bound to `team`-that-is-being-created's `color`:

```html

{{# each(availableColors) }}
{{ . }}
{{/ each }}

```

There's a bug where
1. `can-connect` is adding the newly created team to the list of teams.
2. `availableColors` changes, which causes a mutation,
3. Removing the newly created color from the list of options.
4. which updates the `team`-that-is-being-created's `color`

This all happens before the `team`-that-is-being-created is replaced by a new Team:

```js
this.teamSavePromise = this.team.save(function(){
self.team = new Team();
});
```

This "race" condition changes because of zones. Without zones, the mutation happens after the promise is resolved. With zones, the mutation fires before the zone fires.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.