Skip to content

Commit

Permalink
Race condition loading shapes (#749)
Browse files Browse the repository at this point in the history
* Make the draw.render event fire after cleanup

This means that the draw control is in its final state when the event is fired
so that it is safe for anything responding to the event to make changes to
the draw instance

* mark the store as dirty to properly render the first time.
  • Loading branch information
nigelsim authored and mcwhittemore committed Apr 1, 2018
1 parent 3ce702d commit 1cef23c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ module.exports = function render() {
});
}

store.ctx.map.fire(Constants.events.RENDER, {});
cleanup();
store.ctx.map.fire(Constants.events.RENDER, {});

function cleanup() {
store.isDirty = false;
Expand Down
1 change: 1 addition & 0 deletions src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = function(ctx) {
ctx.map.addLayer(style);
});

ctx.store.setDirty(true);
ctx.store.render();
},
// Check for layers and sources before attempting to remove
Expand Down

0 comments on commit 1cef23c

Please sign in to comment.