mirror of
https://github.com/wekan/wekan.git
synced 2025-12-19 17:00:13 +01:00
Fix board reloading page every second.
Thanks to xet7 !
This commit is contained in:
parent
ef19c35b5a
commit
b4b598f542
1 changed files with 53 additions and 28 deletions
|
|
@ -17,6 +17,8 @@ BlazeComponent.extendComponent({
|
||||||
this.isConverting = new ReactiveVar(false);
|
this.isConverting = new ReactiveVar(false);
|
||||||
this.isMigrating = new ReactiveVar(false);
|
this.isMigrating = new ReactiveVar(false);
|
||||||
this._swimlaneCreated = new Set(); // Track boards where we've created swimlanes
|
this._swimlaneCreated = new Set(); // Track boards where we've created swimlanes
|
||||||
|
this._boardProcessed = false; // Track if board has been processed
|
||||||
|
this._lastProcessedBoardId = null; // Track last processed board ID
|
||||||
|
|
||||||
// The pattern we use to manually handle data loading is described here:
|
// The pattern we use to manually handle data loading is described here:
|
||||||
// https://kadira.io/academy/meteor-routing-guide/content/subscriptions-and-data-management/using-subs-manager
|
// https://kadira.io/academy/meteor-routing-guide/content/subscriptions-and-data-management/using-subs-manager
|
||||||
|
|
@ -28,19 +30,31 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
const handle = subManager.subscribe('board', currentBoardId, false);
|
const handle = subManager.subscribe('board', currentBoardId, false);
|
||||||
|
|
||||||
Tracker.nonreactive(() => {
|
// Use a separate autorun for subscription ready state to avoid reactive loops
|
||||||
Tracker.autorun(() => {
|
this.subscriptionReadyAutorun = Tracker.autorun(() => {
|
||||||
if (handle.ready()) {
|
if (handle.ready()) {
|
||||||
|
// Only run conversion/migration logic once per board
|
||||||
|
if (!this._boardProcessed || this._lastProcessedBoardId !== currentBoardId) {
|
||||||
|
this._boardProcessed = true;
|
||||||
|
this._lastProcessedBoardId = currentBoardId;
|
||||||
|
|
||||||
// Ensure default swimlane exists (only once per board)
|
// Ensure default swimlane exists (only once per board)
|
||||||
this.ensureDefaultSwimlane(currentBoardId);
|
this.ensureDefaultSwimlane(currentBoardId);
|
||||||
// Check if board needs conversion
|
// Check if board needs conversion
|
||||||
this.checkAndConvertBoard(currentBoardId);
|
this.checkAndConvertBoard(currentBoardId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.isBoardReady.set(false);
|
this.isBoardReady.set(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
|
||||||
|
onDestroyed() {
|
||||||
|
// Clean up the subscription ready autorun to prevent memory leaks
|
||||||
|
if (this.subscriptionReadyAutorun) {
|
||||||
|
this.subscriptionReadyAutorun.stop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ensureDefaultSwimlane(boardId) {
|
ensureDefaultSwimlane(boardId) {
|
||||||
|
|
@ -441,10 +455,14 @@ BlazeComponent.extendComponent({
|
||||||
this._isDragging = false;
|
this._isDragging = false;
|
||||||
// Used to set the overlay
|
// Used to set the overlay
|
||||||
this.mouseHasEnterCardDetails = false;
|
this.mouseHasEnterCardDetails = false;
|
||||||
|
this._sortFieldsFixed = new Set(); // Track which boards have had sort fields fixed
|
||||||
|
|
||||||
// fix swimlanes sort field if there are null values
|
// fix swimlanes sort field if there are null values
|
||||||
const currentBoardData = Utils.getCurrentBoard();
|
const currentBoardData = Utils.getCurrentBoard();
|
||||||
if (currentBoardData && Swimlanes) {
|
if (currentBoardData && Swimlanes) {
|
||||||
|
const boardId = currentBoardData._id;
|
||||||
|
// Only fix sort fields once per board to prevent reactive loops
|
||||||
|
if (!this._sortFieldsFixed.has(`swimlanes-${boardId}`)) {
|
||||||
const nullSortSwimlanes = currentBoardData.nullSortSwimlanes();
|
const nullSortSwimlanes = currentBoardData.nullSortSwimlanes();
|
||||||
if (nullSortSwimlanes.length > 0) {
|
if (nullSortSwimlanes.length > 0) {
|
||||||
const swimlanes = currentBoardData.swimlanes();
|
const swimlanes = currentBoardData.swimlanes();
|
||||||
|
|
@ -458,10 +476,15 @@ BlazeComponent.extendComponent({
|
||||||
count += 1;
|
count += 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this._sortFieldsFixed.add(`swimlanes-${boardId}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix lists sort field if there are null values
|
// fix lists sort field if there are null values
|
||||||
if (currentBoardData && Lists) {
|
if (currentBoardData && Lists) {
|
||||||
|
const boardId = currentBoardData._id;
|
||||||
|
// Only fix sort fields once per board to prevent reactive loops
|
||||||
|
if (!this._sortFieldsFixed.has(`lists-${boardId}`)) {
|
||||||
const nullSortLists = currentBoardData.nullSortLists();
|
const nullSortLists = currentBoardData.nullSortLists();
|
||||||
if (nullSortLists.length > 0) {
|
if (nullSortLists.length > 0) {
|
||||||
const lists = currentBoardData.lists();
|
const lists = currentBoardData.lists();
|
||||||
|
|
@ -475,6 +498,8 @@ BlazeComponent.extendComponent({
|
||||||
count += 1;
|
count += 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this._sortFieldsFixed.add(`lists-${boardId}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRendered() {
|
onRendered() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue