feat: /lend/* pages server switch-up#3991
Conversation
| @@ -0,0 +1,553 @@ | |||
| <template> | |||
There was a problem hiding this comment.
Is there a good way to share this fairly large component? It looks like the only difference from the existing page is the use of WwwPage.
There was a problem hiding this comment.
I think we can just delete the existing funded borrower profile page.
| }, | ||
| { | ||
| path: '/lend/:id(\\d+)', | ||
| redirect: '/lend-beta/:id' |
There was a problem hiding this comment.
Won't this still have pages loading at the /lend-beta/### url? Why not define the BorrowerProfile page component here as well and just use /lend/###...
There was a problem hiding this comment.
Yeah.. sounds right. @emuvente would this imply setting a canonical url for the Borrower Profile page?
There was a problem hiding this comment.
This redirect should be the other way around:
{
path: '/lend-beta/:id',
redirect: '/lend/:id'
}
And the route for the borrower profile should be changed from /lend-beta/:id to /lend/:id(\\d+):
{
name: 'borrowerProfile',
path: '/lend/:id(\\d+)',
component: () => import('@/pages/BorrowerProfile/BorrowerProfile'),
meta: {
excludeFromStaticSitemap: true,
unbounce: true,
},
},
Then there is no need to set a canonical, because the default will be fine.
| const queryString = Object.keys(query) | ||
| .map(key => `${key}=${query[key]}`) | ||
| .join('&'); | ||
| this.$router.push(`/lend-classic/${this.$route.params.id}?query=${queryString}`); |
There was a problem hiding this comment.
I think there are some other conditions we'll need to check here...and maybe be able to get rid of this exp cookie check altogether...
- If a loan is
inPfpwe redirect to legacy (https://github.com/kiva/kiva/blob/development/sites/www_kiva/server/views/Xb/Loan/LoanView.php#L95) - If the lender is an RTP Translator we skip the experiment (https://github.com/kiva/kiva/blob/development/httpdocs/classes/API/Experiment/LoanDetailBeta.php#L22)
There was a problem hiding this comment.
@mcstover Sounds good! Is there a way to get if lender has a RTP Volunteer role?
There was a problem hiding this comment.
@christian14b As of my latest merged PR 1 above is not true. UI will now render inPfp loans
There was a problem hiding this comment.
@mcstover I think we can ignore those other conditions now. UI will render inPfp loans and volunteers will be directed to /lend-classic from Viva after the monolith pr is live, correct?
@christian14b This check and redirect should happen in the prefetch instead of created. Here's an example of doing a redirect from preFetch:
ui/src/components/Forms/JoinTeamForm.vue
Lines 66 to 87 in 05094cf
| @@ -0,0 +1,553 @@ | |||
| <template> | |||
There was a problem hiding this comment.
I think we can just delete the existing funded borrower profile page.
| const queryString = Object.keys(query) | ||
| .map(key => `${key}=${query[key]}`) | ||
| .join('&'); | ||
| this.$router.push(`/lend-classic/${this.$route.params.id}?query=${queryString}`); |
There was a problem hiding this comment.
@mcstover I think we can ignore those other conditions now. UI will render inPfp loans and volunteers will be directed to /lend-classic from Viva after the monolith pr is live, correct?
@christian14b This check and redirect should happen in the prefetch instead of created. Here's an example of doing a redirect from preFetch:
ui/src/components/Forms/JoinTeamForm.vue
Lines 66 to 87 in 05094cf
| }, | ||
| { | ||
| path: '/lend/:id(\\d+)', | ||
| redirect: '/lend-beta/:id' |
There was a problem hiding this comment.
This redirect should be the other way around:
{
path: '/lend-beta/:id',
redirect: '/lend/:id'
}
And the route for the borrower profile should be changed from /lend-beta/:id to /lend/:id(\\d+):
{
name: 'borrowerProfile',
path: '/lend/:id(\\d+)',
component: () => import('@/pages/BorrowerProfile/BorrowerProfile'),
meta: {
excludeFromStaticSitemap: true,
unbounce: true,
},
},
Then there is no need to set a canonical, because the default will be fine.
| }; | ||
| }, | ||
| apollo: { | ||
| preFetch(config, client, { cookieStore, route }) { |
There was a problem hiding this comment.
This prefetch is going to be called even if the funded borrower profile isn't shown, which will slow down the loading of the page. Instead, this data could be fetched conditionally in the BorrowerProfile prefetch or could be merged with the borrower profile query, and then passed into this component through props.
| id="borrower-profile" | ||
| > | ||
| <article class="tw-relative md:tw-bg-secondary"> | ||
| <article v-if="amountLeft" class="tw-relative md:tw-bg-secondary"> |
There was a problem hiding this comment.
This should also check that the loan status is "fundraising", because loans can also have an amount left when they are paying pack.
|
@christian14b I noticed in |
| path: `/lend-classic/${route.params.id}`, | ||
| query, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Maybe in the near future we'll be able to get rid of this expCookie stuff and just provide a query param to allow bypass to the legacy bp...or a link in the page.
This pr makes the following server changes for /lend/* pages :
These changes come along with monolith updates #10728