Update jq-repeat to 2.1.0; fix removed __setPut/__setTake API
jq-repeat 2.1.0 (release notes: https://github.com/wmantly/jq-repeat/releases/tag/v2.1.0) brings real fixes (throttled-update race conditions, sorted-list reverse() leaking elements, nested-scope isolation) and a few behavior changes. Audited every usage in this repo against the changelog before upgrading: - push()/unshift() now return the new array length -- every call site in this repo is a bare statement, none consume the return value. No risk. - update() is now trailing-edge throttled (~50ms) even on the first call, not just rapid subsequent ones -- no code in this repo reads DOM/item state immediately after calling update(), so no risk here (unlike sso-manager-node's companion PR, which needed a fix). - jr-order-reverse and nested jq-repeat templates: not used anywhere in this repo. Real breakage found and fixed: users.ejs/groups.ejs/permissions.ejs called $.scope.X.__setPut(fn)/__setTake(fn) as setter METHODS -- that API is gone in 2.1.0. Insert/remove hooks are now set via direct property assignment ($.scope.X.__put = fn), per the current README. Verified live (real dev server + Playwright): before the fix, all three pages threw "__setTake is not a function" and the insert/remove row animations were broken; after, zero errors and the hooks fire correctly.
This commit is contained in:
@@ -60,10 +60,10 @@
|
||||
|
||||
loadUserSuggestions();
|
||||
|
||||
$.scope.LocalGroup.__setTake(function($el){
|
||||
$.scope.LocalGroup.__take = function($el){
|
||||
$el.addClass('bg-danger');
|
||||
$el.fadeOut(600, function(){ $el.remove(); });
|
||||
});
|
||||
};
|
||||
|
||||
app.subscribe(/^model:LocalGroup:create/, function(data){
|
||||
$.scope.LocalGroup.remove(data.name);
|
||||
|
||||
@@ -57,10 +57,10 @@
|
||||
|
||||
loadSubjectSuggestions();
|
||||
|
||||
$.scope.Permission.__setTake(function($el, item, list){
|
||||
$.scope.Permission.__take = function($el, item, list){
|
||||
$el.addClass('bg-danger');
|
||||
$el.fadeOut(600, function(){ $el.remove(); });
|
||||
});
|
||||
};
|
||||
|
||||
// Live updates (model:Permission:*), so adds/removes reflect for everyone.
|
||||
app.subscribe(/^model:Permission:create/, function(data){
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
for(let user of data.results){
|
||||
$.scope.users.push(user);
|
||||
}
|
||||
$.scope.users.__setPut(function($el, item, list){
|
||||
$.scope.users.__put = function($el, item, list){
|
||||
$el.addClass('bg-success');
|
||||
$el.fadeIn(3000, function(){
|
||||
$el.removeClass('bg-success');
|
||||
});
|
||||
})
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
$(document).ready(function(){
|
||||
populateUsers(); //populate the table
|
||||
|
||||
$.scope.users.__setTake(function($el, item, list){
|
||||
$.scope.users.__take = function($el, item, list){
|
||||
$el.addClass('bg-danger');
|
||||
$el.fadeOut(1000, function(){
|
||||
$el.remove()
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user