Skip to content

setupTodos using incorrect logic and skipping to-do item.#705

Merged
svilenmarkov merged 1 commit intoglanceapp:devfrom
rhijjawi:dev
Jun 10, 2025
Merged

setupTodos using incorrect logic and skipping to-do item.#705
svilenmarkov merged 1 commit intoglanceapp:devfrom
rhijjawi:dev

Conversation

@rhijjawi
Copy link
Contributor

@rhijjawi rhijjawi commented May 27, 2025

After looking over #703, I realized that todo.default(elems[i]) in page.js was overwriting elements while still reading over them in the loop.

export default function(element) {
    element.swapWith(
        Todo(element.dataset.todoId)
    )
}

This causes a Todo element to "disappear" as it takes the position of the overwritten element and being skipped in the iteration.

The fix is to create a copy of the element array so that it is maintained while changes are being made to the document.

Copy link
Member

@svilenmarkov svilenmarkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

@svilenmarkov svilenmarkov merged commit 429f0be into glanceapp:dev Jun 10, 2025
Zykairotis pushed a commit to Zykairotis/glanceXags that referenced this pull request Jan 8, 2026
setupTodos using incorrect logic and skipping to-do item.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants