Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Using groupBy filter with ng-repeat in template on iOS9 iPhone4 causes infinite repeating

未关闭
#203 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angularjs, javascript
领域
frontend, mobile

调研方向

这个 issue 涉及 groupBy 过滤器在 iOS9 iPhone4 上导致无限重复。首先检查 angular-filter 库中 groupBy 过滤器的实现。使用提供的模板代码,在 iOS9 模拟器或设备上复现该 bug。查找 iOS9 上 JavaScript 执行或 AngularJS digest 周期的差异。检查过滤器是否稳定,以及它是否会原地修改 array。修复可能需要确保过滤器输出是确定性的,并且不会触发无限的 $digest 循环。

由索引模型根据 Issue 内容生成。

描述

I found that when using the groupBy filter within the template with an ng-repeat that iPhone4 on iOS9 would infinitely repeat the data, causing it to crash the browser if there was a particularly large set of data. This behaviour didn't present on any other devices I was testing (desktop Chrome, FF, IE9+, Android device using Chrome browser) including an iPhone 4 on iOS8.

An example of the template code I was using is as follows (where groupingMonth is an attribute of data):

<div ng-repeat="group in data | groupBy: 'groupingMonth' | toArray:true | orderBy: '$key': true">

I ended up being able to resolve the problem for my current purposes by moving the filters into the controller, eg:

$scope.groupedData = $filter('orderBy')($filter('toArray')($filter('groupBy')($scope.data, 'groupingMonth'), true), '$key', true);

<div ng-repeat="group in groupedData">

Either the groupBy filter shouldn't be used in the ng-repeat and perhaps something documented to say as such would help others, or something has fundamentally changed with iOS9 which causes this behaviour regardless of how the filter is written. I investigated as much as I could but wasn't able to pin down why this behaviour presents in iOS9 and not iOS8. I used angular-filter v0.5.5 and tried upgrading to 5.5.8 with the same behaviour seen on both.

主要语言
JavaScript
星标
2.9k
派生
319
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

a8m/angular-filter 的其他 Issue

查看 a8m/angular-filter 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。