fix: don't assume that list of IDs to fetch and list of fetched objects are the same length (#4322)

This commit is contained in:
ggurdin 2025-10-10 10:45:09 -04:00 committed by GitHub
parent dc8bb8fe8c
commit 7348024bf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,8 +60,9 @@ class CourseLocationRepo {
if (toFetch.isNotEmpty) {
final fetchedLocations = await _fetch(courseId, toFetch);
locations.addAll(fetchedLocations);
for (int i = 0; i < toFetch.length; i++) {
await _setCached(toFetch[i], fetchedLocations[i]);
for (int i = 0; i < fetchedLocations.length; i++) {
final location = fetchedLocations[i];
await _setCached(location.uuid, location);
}
}