-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Is it possible to use ember-infinity
with ember-concurrency
?
#314
Comments
@pkimber Really interesting stuff! I like what you are doing here but I think there could be a bit simpler path. A couple of questions just to help me understand better...
a. Move the fetching logic into a component. So no model hook for your route nor controller. What I put here isn't perfect and may/may not work, but should give you an idea of what is possible
Then use it like so in a top level template:
|
Thank you @snewcomer for taking the time to answer my question.
I will take the time to try and understand. Thank you again for your help. Very much appreciated... |
I have recently got something very similar to this working. Eventually I'll try to extract the pattern out for my own use and to share but for now I'll just say I've been able to get it working very nicely. |
I've just compared @snewcomer example to my fully working implementation from a few weeks ago and they are identical in the pattern. I have really seen no downside with this approach. It really cleaned things up by isolating the data loading into the component. The only difference I see is that I am already debouncing my input to this component so I am not using timeout, but maybe I should? I also implemented skeleton content placeholders in conjunction with this, taking advantage of ember-concurrency derived state which has made for a really nice UX. We started with ember-content-placeholders but quickly decided to build our own to fit our content exactly. Maybe we can start a 'Cookbook' section somewhere in the documentation to give things like this pattern a nice home. |
I completely agree so let's do it! Perhaps a PR that we can both iterate on (hopefully not too time consuming)? Lmk what you think. |
Sounds great to me. I am happy to test it... |
@snewcomer Are you thinking we add this as a section to README.md or maybe we should use the Wiki? |
Great idea. Perhaps a wiki with link in Readme? |
I've been using ember-infinity in a similar way recently. The pattern works really well. 👍for service based infinity models! It's not immediately clear from the README yet that this kind of stuff is possible. I'd say that's mainly because the README only focusses on using infinity in the model hook. Just to comment on the |
This is super rad. Now I want to rewrite a bunch of things.... |
@scottkidder @nickschot @pkimber I think ya'll are onto something 😄. Would anybody like to put up a PR in the README/or paste a shortened version here to show what is possible with e-c and components? I think it would be useful to put this towards the top based on what ya'll are saying!! Perhaps we will move the content to a wiki if it makes sense. Separately, I'll put up a PR to add navigation to various sections b/c scrolling through the whole README kinda is painful. |
I just open sourced a WIP of 'ember-model-select' which retrieves options based on a model (and optional filter). It's an ember-power-select wrapper which adds (optional) infinite scroll support through ember-infinity/ember-concurrency. For a sneak peek of where infinity is hidden see: https://github.com/weddingshoppe/ember-model-select/blob/master/addon/components/model-select.js#L232 |
Woah
…On Wed, Sep 5, 2018 at 11:27 AM Nick Schot ***@***.***> wrote:
I just open sourced a WIP of 'ember-model-select' which retrieves options
based on a model (and optional filter). It's an ember-power-select wrapper
which adds (optional) infinite scroll support through
ember-infinity/ember-concurrency.
For a sneak peek of where infinity is hidden see:
https://github.com/weddingshoppe/ember-model-select/blob/master/addon/components/model-select.js#L232
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#314 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACu4_DBZHHqhCGpSjDvQc4vQR5fQiynMks5uX-1HgaJpZM4V2USw>
.
|
There is another possible issue I found with this approach. It seems the infinity service keeps it's array of infinityModels indefinitely and using ember-concurrency to filter it we generate a lot of them. @snewcomer do we clean this up ourselves by overriding the attribute on the service with an empty EmberArray? |
@nickschot Do you have a specific example? There are a few service methods available if that may help. Lmk though! - https://github.com/ember-infinity/ember-infinity#service-methods |
Is it possible to use
ember-infinity
withember-concurrency
(I am learningember
andjavascript
)?I have the following code in my route:
And this in my
hbs
file:It is nearly working, but the
infinity-loader
never finishes loading and every request to the server is duplicated.Any thoughts would be appreciated. Thank you.
The text was updated successfully, but these errors were encountered: