-
Notifications
You must be signed in to change notification settings - Fork 249
Idea: Preload .json files on link hover #680
Comments
I like this idea. I think we can package this into a HOC for PageContainer |
Good idea :) |
Hi, is this issue open to new contributor / first timer? |
@iDams yes. That's why it was tagged with |
@thangngoc89 Nice, I'll give it a try with HOC for PageContainer |
@iDams Nice. But I think it should be a HOC for LayoutContainer. We want to catch all links, not just links inside markdown content. |
@thangngoc89 I don't see any |
@iDams sorry. It was renamed to AppContainer. Any way, this doesn't change anything. It's a HOC, we can mount it where ever we want |
@thangngoc89 You're right. Thanks! |
What is the difference between |
@iDams hi there. |
@iDams use the chat https://gitter.im/MoOx/phenomic if you need a hand for this :) |
Should the hover add the page to the pages array or to a new key I had plans on using the There are potentially other reasons why we'd want this prefetched page in a different key for remote debugging etc. |
@DavidWells pages store will go await soon, don't rely on this. Phenomic data won't be store in redux anymore (read only, no real need), and we will provides HoC for consuming collection instead of the current mess. |
Ok cool. Looking forward to seeing some of the updates. Redux isn't going away is it? I'm using that for user auth stuff (I guess it would still work with phenomics wrapper though heh) |
Redux is going await for Phenomic, but you will definitely still be able to use it on your own. I will provide migration instructions for people that rely on it, don't worry ;) |
@thangngoc89 @MoOx thanks! |
@MoOx @thangngoc89 I'm trying to get this rolling. Where would I start? If redux is going away, where is the fetch call happening and how can I add the requested |
@DavidWells make a HOC that add event listener on every link inside it. The callback for that listener should be passed as props. We can swap it later when redux goes away |
(basically you are making a React component) |
@DavidWells I was already trying to work on it but you can do it. You started the issue and I don't have time right now to work on it. I'll take another issue when I see one for new contributor ;) |
@DavidWells not sure what is the best approach yet, I am finishing webpack 2 integration + caching and I will remove redux after that (and will think of a way to handle this issue). @iDams you can probably take any issue you want, just ask for it so we can point you in the right direction :) |
@MoOx sounds good! 👍 |
@iDams be sure check out our new Help wanted board |
@thangngoc89 I will thanks! |
@MoOx @thangngoc89 Is this possible for me to start working on with the current setup or does redux need to be removed from the internals first? I want to start prefetching the json files for a even snappier experience =) |
I would advise to wait, I am going to work on the new collection API this week (so redux removal planned). But maybe if you are in a hurry, you can take a stab at it right now, and I will handle the change when removing redux... |
Fetching the data is no problem. The question is where to put it :) Sounds like that will be changing with this though. I will write the logic for the component. Is there an issue / branch to follow along on the new collection API?
|
Hey @MoOx any updates on how the collections are going to work without redux? Do you want help/ideas on the collections updates? My main goals would be:
something like: window.collection = {
'url-slug-here' : {
data: 'link-to-data15562.json',
otherDataIWantToGrabWithoutWaitingForJSONDownload: 'blah',
},
'other-url/slug/here' : {
data: 'link-to-data12313.json',
otherDataIWantToGrabWithoutWaitingForJSONDownload: 'title xyz',
},
} Then I could grab data super easily without having to loop through potentially large collections. Just a simple Let me know your thoughts and how I can help! Also related: #713 (comment) |
@DavidWells I am going to work on the collection refactoring right now, so stay tuned. Not sure we will be able to remove the collection completely. Need to think about this more. Meanwhile I think using a script to load it is pretty easy to handle. Will try that. |
This will be a feature that will come later and that won't be tied to json or whatever comes with the link |
Had this idea the other day similar to what https://github.com/dieulot/instantclick does.
The idea is having
<Link>
prefetch the page's corresponding.json
data file when a link is hovered on.Link hover -> prefetch json -> update redux page store (without actually changing the route) -> user clicks for instant page load
Not proposing to do this for all links but might be interesting for better UX with a 'faster' page load times. =)
Alternate crazy idea: Preload based on mouse position like http://gabrielbull.github.io/react-aim/ =P
The text was updated successfully, but these errors were encountered: