Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'fetch' not being able to find an item at all, and 'update' not being able to ever update #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

holl0wstar
Copy link

@holl0wstar holl0wstar commented Jan 29, 2019

So, this fixes a fairly peculiar issue with the fetch method.

The const data = await this.fetchAll(config); method returns an Array, and the old code used hasOwnProperty, which is meant for objects. That meant the code would always return false, and whatever the engine was looking for would never be found.

After a bit of brainstorming with Sean, we figured it out. I changed it to a find method, instead, and it works like a charm.

My bundle, Wvnder -- A OLC system I'm working on, depends on these changes. There may be more to come, since I've only patched up the YAML sources for the Rooms for the time being.

So, this fixes a fairly peculiar issue with the `fetch` method.

The `const data = await this.fetchAll(config);` method returns an `Array`, and the old code used `hasOwnProperty`, which is meant for objects. That meant the code would always return false, and whatever the engine was looking for would never be found.

After a bit of brainstorming with Sean, we figured it out. I changed it to a `find` method, instead, and it works like a charm.
@holl0wstar
Copy link
Author

I made a change to the update method - It couldn't update by id previously because of the fetchAll being an Array. In this case, it would never be able to update at all. I changed it to be able to update by picking out the index and just setting the object.

It feels a bit hacky, but it works.

@holl0wstar holl0wstar changed the title Fix 'fetch' not being able to find an item at all Fix 'fetch' not being able to find an item at all, and 'update' not being able to ever update Jan 29, 2019
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