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

Mapper afterFind/ afterFindAll.. not firing on related "with". #9

Open
kvandelden opened this issue May 4, 2017 · 4 comments
Open

Comments

@kvandelden
Copy link

This isn't an issue if you believe it's right. v3

When executing a DataStore.find or findAll w/ with: [...] options.
The mapper afterFind/ and afterFindAll will only fire for the top level record(s).
The adapter afterFind/ and afterFindAll will fire for the related records..

When calling loadRelations.. the mapper afterFind/ afterFindAll fire's for everything.

Huge js-data fan.... K

@crobinson42
Copy link
Member

@kvandelden do you suggests any changes to the way things work here? Perhaps you might have an idea of how this business logic should go or maybe you might suggest a flag option?

@kvandelden
Copy link
Author

I managed without the related records firing after* events.

I ended up writing a bulk record loader to avoid record by record "loadRelationships" calls. This performed better by avoiding latency due to resolving a single record's relationships at a time. The loader would log keys it has to resolve while traversing the relationship tree... (recursively down hasMany relationships).. and finally resolving the belongsTo relationships once all the hasMany relationships were resolved. Each belongsTo relationship target is resolved with a single findAll call.

Thanks, K

@crobinson42
Copy link
Member

@kvandelden we're working on a v4 of js-data. Is this something that you might want to contribute to in the next release? @luisvt has started the TS rewrite already and is on branch v4 in case you're interested.

@kvandelden
Copy link
Author

Cory, I am excited to see js-data advancing into typescript. We use a modified version of js-data in our PwC Performance Analyzer product... We have enhanced, extended the library in a number of ways to improve performance for our data scale.. (Hash Index vs B-Tree, ), usability in line of business applications.. (Key generation, soft deletes, time stamp fields, bulk/atomic saving service). Some of the extensions don't fit the js-data API/ expected test behaviors.. i.e. we generate unique keys for all our records at row creation time, therefore we can use a dictionary for indexing.. also, the bulk writing mechanism API is outside of the standard API for saving records.
https://github.com/kvandelden/js-data/commits/master

At the moment, I am committed to deliver an addition to our product.. and consequently, I will not be able to contribute until April.
Looking forward to helping out then..

Thanks, Kurt

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

No branches or pull requests

2 participants