Skip to content

Conversation

@dapize
Copy link

@dapize dapize commented Dec 18, 2025

Fix: use this instead of db inside AppDB.populate() method

The populate() method was referencing the module-level db variable before it was declared. While this works due to JavaScript's execution timing (the callback runs after instantiation), it's technically incorrect and could cause unexpected behavior with multiple instances.

Changed db.todoListsthis.todoLists and db.todoItemsthis.todoItems

Fix: use `this` instead of `db` inside AppDB.populate() method

The populate() method was referencing the module-level `db` variable before it was declared. While this works due to JavaScript's execution timing (the callback runs after instantiation), it's technically incorrect and could cause unexpected behavior with multiple instances.

Changed `db.todoLists` → `this.todoLists` and `db.todoItems` → `this.todoItems`
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.

1 participant