mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-10-30 18:37:14 +08:00
Add protection against spurious updates
This commit is contained in:
@ -4,6 +4,7 @@ Session.set('editor.glyph', undefined);
|
|||||||
|
|
||||||
const types = ['path', 'bridges', 'strokes', 'analysis', 'order', 'verified'];
|
const types = ['path', 'bridges', 'strokes', 'analysis', 'order', 'verified'];
|
||||||
let last_glyph = undefined;
|
let last_glyph = undefined;
|
||||||
|
let last_json = undefined;
|
||||||
let stage = new stages.AbstractStage;
|
let stage = new stages.AbstractStage;
|
||||||
|
|
||||||
const changeGlyph = (method, argument) => {
|
const changeGlyph = (method, argument) => {
|
||||||
@ -116,8 +117,10 @@ Template.status.helpers({
|
|||||||
|
|
||||||
Tracker.autorun(() => {
|
Tracker.autorun(() => {
|
||||||
const glyph = Session.get('editor.glyph');
|
const glyph = Session.get('editor.glyph');
|
||||||
if (!glyph) return;
|
const json = JSON.stringify(glyph);
|
||||||
if (!last_glyph || glyph.character !== last_glyph.character) {
|
if (!glyph || json === last_json) {
|
||||||
|
return;
|
||||||
|
} else if (!last_glyph || glyph.character !== last_glyph.character) {
|
||||||
let last_completed_stage = types[0];
|
let last_completed_stage = types[0];
|
||||||
types.map((x) => { if (glyph.stages[x]) last_completed_stage = x; });
|
types.map((x) => { if (glyph.stages[x]) last_completed_stage = x; });
|
||||||
constructStage(last_completed_stage);
|
constructStage(last_completed_stage);
|
||||||
@ -129,6 +132,7 @@ Tracker.autorun(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
last_glyph = glyph;
|
last_glyph = glyph;
|
||||||
|
last_json = json;
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user