I need some advice on supporting user profile content in any resource at any route level.
Consider this discussion page, and the response to clicking on the user profile icon next to the thread. With a click, some amount of user profile loads in a popover dialog. The URL doesn’t change, here, so without further investigation I can surmise that no additional data has been fetched for this dialog. I am trying to accomplish something very similar to this, with a few modifications, as follows:
- The full user data object has not yet been delivered to the store. Given no other options, I can change this but I am very concerned about page response times with that amount of data.
- I need to support deep linking (think email campaigns, bookmarks, share actions, etc), so I will need to support the modified URL.
- The intent is to add profile content to the page - modal, popover, etc - so I’ll need to maintain the current content view and inject into something like a dedicated outlet.
- This activity - identical in every way - needs to occur under disconnected routes and resources. This re-use is the crux of the issue.
I know how to use the dynamic segments. Given a single instance of this profile activity, I’m golden. Once I try to abstract it and implement it on multiple routes, I start to lose my plan. So, I have the current set of questions:
- Can I just universally apply a dynamic segment to ALL resources/routes? I was hoping for something a little more clever than just redefining the segment for every possible route in the app.
- Once I hit the ‘renderTemplate’ step of this route, I’ll need some way of managing the combination of “outlet” and “into”. I know these values can be variable, but I’m curious how I would “pass them in”?
- Would this universal dynamic segment have access to the “parent” route?
- Could I, in some other way, instantiate the dynamic segment so that I don’t have to get the names of the “into” and “outlet” (getting them feels like I’m breaking encapsulation)?
- Has anyone experienced any fail-points that I should plan around here?
I’m still in the planning phase of this, so I don’t have any errors to share. I’d love any feedback - planning, code snippets, examples of someone already doing this.