Knockout-Contrib / Knockout-Contrib/KoGrid

SortInfo - executed twice on subscribe

Open
#271 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
277
Forks
124
PR merge metrics
No merged PRs in 30d

Description

If you are using `sortInfo` it will be executed twice in code:

``` javascript
self.sortData = function (col, direction) {
// if external sorting is being used, do nothing.
self.isSorting = true;
self.sortInfo({ // this is causing first execution
column: col,
direction: direction
});
self.clearSortingData(col);
if(!self.config.useExternalSorting){
window.kg.sortService.Sort(self.sortInfo.peek(), self.sortedData);
} else {
self.config.sortInfo(self.sortInfo.peek()); // this second one
}
self.lastSortedColumn = col;
self.isSorting = false;
};
```

solution is quite straight forward, delay `self.sortInfo` change

will try to do pull request but I don't have access to git from my work :(

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the sortData function shown in the issue and trace the sortInfo subscription callbacks. Confirm that changing sortInfo causes two executions, then defer the change so subscription handling occurs once. Verify that both internal and external sorting still behave correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.