Skip to content

Commit

Permalink
fix(router): correctly bypass route.tab.options.props to tab component
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed May 31, 2021
1 parent ab6b101 commit f3326e2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/react/components/tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ const Tab = forwardRef((props, ref) => {
routerContext.route.route.tab &&
routerContext.route.route.tab.id === id
) {
const { component, asyncComponent } = routerContext.route.route.tab;
const { component, asyncComponent, options: tabRouteOptions } = routerContext.route.route.tab;
if (component || asyncComponent) {
initialTabContent = {
id: getComponentId(),
component: component || asyncComponent,
isAsync: !!asyncComponent,
props: {
...((tabRouteOptions && tabRouteOptions.props) || {}),
f7router: routerContext.router,
f7route: routerContext.route,
...routerContext.route.params,
Expand Down
6 changes: 6 additions & 0 deletions src/react/shared/components-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
}

const id = getComponentId();

const tabContent = {
id,
component,
Expand All @@ -117,6 +118,11 @@ export default {
f7route: options.route,
f7router: router,
},
(options.route.route &&
options.route.route.tab &&
options.route.route.tab.options &&
options.route.route.tab.options.props) ||
{},
options.route.params,
options.props || {},
),
Expand Down
3 changes: 2 additions & 1 deletion src/svelte/components/tab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
RouterContext.route.route.tab &&
RouterContext.route.route.tab.id === id
) {
const { component, asyncComponent } = RouterContext.route.route.tab;
const { component, asyncComponent, options: tabRouteOptions } = RouterContext.route.route.tab;
if (component || asyncComponent) {
initialTabContent = {
id: getComponentId(),
component: component || asyncComponent,
isAsync: !!asyncComponent,
props: {
...((tabRouteOptions && tabRouteOptions.props) || {}),
f7router: RouterContext.router,
f7route: RouterContext.route,
...RouterContext.route.params,
Expand Down
5 changes: 5 additions & 0 deletions src/svelte/shared/components-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export default {
f7route: options.route,
f7router: router,
},
(options.route.route &&
options.route.route.tab &&
options.route.route.tab.options &&
options.route.route.tab.options.props) ||
{},
options.route.params,
options.props || {},
),
Expand Down
3 changes: 2 additions & 1 deletion src/vue/components/tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ export default {
route.route.tab &&
route.route.tab.id === props.id
) {
const { component, asyncComponent } = route.route.tab;
const { component, asyncComponent, options: tabRouteOptions } = route.route.tab;
if (component || asyncComponent) {
initialTabContent = {
id: getComponentId(),
component: component || asyncComponent,
isAsync: !!asyncComponent,
props: {
...((tabRouteOptions && tabRouteOptions.props) || {}),
f7router: router,
f7route: route,
...route.params,
Expand Down
5 changes: 5 additions & 0 deletions src/vue/shared/components-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export default {
f7route: options.route,
f7router: router,
},
(options.route.route &&
options.route.route.tab &&
options.route.route.tab.options &&
options.route.route.tab.options.props) ||
{},
options.route.params,
options.props || {},
),
Expand Down

0 comments on commit f3326e2

Please sign in to comment.