-
Notifications
You must be signed in to change notification settings - Fork 42
Ajax Load Pattern Component #167
Comments
@joesnellpdx what do you think something like this would look like in a component? |
@timwright12 Maybe something I can put my mind to during my PRI. What do you think? |
@joesnellpdx how about something that's platform independent, like a web component? |
That is definitely a possibility. Good idea. |
I've done a lot of these in various projects and in my experience, the smoothest implementations have involved:
All that being said, I took a stab at putting something together as an exercise in thinking about how this could be componentized. You can see it here (most of the functionality exists in this JS file): https://github.com/dkoo/component-load-more/blob/master/src/load-more.js Building out this sketch brought up some important questions that I think warrant further discussion here.
Other limitations of my proof of concept worth mentioning:
Anyway, I want to keep this discussion alive because it's something we build fairly often and I agree that the team could benefit from having a generalized approach to follow. I'm not sure what I've started should be that approach, but I think it's a good starting place to hash out some of these questions. |
I think getting a component is a great idea and I like this as a starting point, but explicitly defining the template output like For it to be a true component in the library (and publish to NPM) it seems like we'd almost need to abstract everything out of the the file and into options and at some point it starts to become something else, right? Like a UI pattern or something that should be broken out into much smaller atomic elements and the result of collecting these elements together can be this loading pattern. Once it's broken down like that you can pass a lot of those decisions like CORS and sanitization onto the application rather than the component. I could see us breaking the site out into components and patterns to get something like this sharable, because it definitely valuable. |
@timwright12 How would you recommend moving the markup to options? Should we have an option that lets you pass a template string of sorts, with the default matching our blogroll component? Or are you suggesting that we think of creating a new category of "patterns" in the component library, where they're not NPM packages that you can drop into your application, but more like recipes you can follow? |
@dkoo I'm thinking of a new category of patterns that could be a collection of npm packages. For example, this pattern could be an example of using npm packages XY and Z to accomplish a "load more posts" functionality |
It would be nice to have an example of ajax loading content (i.e. load more posts) as it seems to be different on every project. I'm not sure if the component library or best practices is the right place, but I'd sure love to know the 'ideal' patterns in a basic sense.
Of course, it is situational, but what is the best pattern for the following, or is there a general preference (situational excluded)?:
The text was updated successfully, but these errors were encountered: