Builder.io page redirecting to another builder.io page
Describe the bug When using custom code to navigate between routes, if I'm in a builder.io route and push to another builder.io route, even though we ask for a different urlPath to builder, we get back the initial page again.
To Reproduce Steps to reproduce the behavior:
- Create a page with a button with custom code, where we call state.link(pageUrl), pageUrl must be a different page but a builder page
- Add the custom code on the page data, in the builder component
- Land on the new page
- Click on the button
- No content change
Expected behavior I should see the page that uses pageUrl for the path
Screenshots Cannot post screenshots due to company policies.
Additional context The custom code for state.link only grabs the route and pushes using react-router this avoid an entire app reload. (If you use a Link or an anchor the entire app reloads causing a cascade of re-renders and requests)
const history = useHistory();
const data = {
link: (route) => history.push(route)
}
useEffect(() => {
builder.get('page', { userAttributes: { urlPath: location.pathname } })
.promise().then((page) => {
if (page) {
setPage(page);
} else {
history.replace('/error');
}
})
}, [location.pathname])
return (
<BuilderComponent
model="page"
content={pageData}
data={data}
/>
)
We also tried using builder.get('page', { url: location.pathname })
While debugging I found that the pathname that we send its the correct one, but the page that we get back is still the current one instead of the new one.
can I get some updates in this issue? @manucorporat