Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/alpinejs/src/directives/x-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
// we need to generate all the keys for every iteration up
// front. These will be our source of truth for diffing.
if (isObject(items)) {
// Support Set object, convert into key value
if (items instanceof Set) {
items = Object.fromEntries(
Array.from(items).map((value, key) => [key, value])
);
}

items = Object.entries(items).map(([key, value]) => {
let scope = getIterationScopeVariables(iteratorNames, value, key, items)

Expand Down