Skip to content

Commit

Permalink
get rid of Obj.magic in doLoadRouteRenderer
Browse files Browse the repository at this point in the history
also made unsafe_toPrepareProps safer
removed unsafe makeRenderer
  • Loading branch information
tsnobip committed Sep 15, 2023
1 parent af5487a commit 0ec4a8a
Show file tree
Hide file tree
Showing 22 changed files with 235 additions and 331 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let renderer = Routes.Root.Todos.ByStatus.Route.makeRenderer(
~prepare=_props => {
let renderer: Routes.Root.Todos.ByStatus.Route.routeRenderer<'prepared> = {
prepare: _props => {
()
},
~render=_props => {
render: _props => {
React.null
},
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let renderer = Routes.Root.Todos.Single.Route.makeRenderer(
~prepare=({environment, showMore, todoId}) => {
let renderer: Routes.Root.Todos.Single.Route.routeRenderer<'prepared> = {
prepare: ({environment, params: {showMore, todoId}}) => {
SingleTodoQuery_graphql.load(
~environment,
~fetchPolicy=StoreOrNetwork,
Expand All @@ -9,7 +9,7 @@ let renderer = Routes.Root.Todos.Single.Route.makeRenderer(
},
)
},
~render=({prepared}) => {
render: ({prepared}) => {
<SingleTodo queryRef=prepared />
},
)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let renderer = Route__Root__Todos_route.makeRenderer(
~prepare=({environment}) => {
let renderer: Route__Root__Todos_route.routeRenderer<'prepared> = {
prepare: ({environment}) => {
TodosListQuery_graphql.load(~environment, ~fetchPolicy=StoreOrNetwork, ~variables=())
},
~render=({prepared, childRoutes}) => {
render: ({prepared, childRoutes}) => {
<TodosList queryRef=prepared> {childRoutes} </TodosList>
},
)
}
8 changes: 4 additions & 4 deletions examples/client-rendering/src/routes/Root_route_renderer.res
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let renderer = Route__Root_route.makeRenderer(
~prepare=({environment}) => {
let renderer: Routes.Root.Route.routeRenderer<'prepared> = {
prepare: ({environment}) => {
LayoutQuery_graphql.load(~environment, ~variables=(), ~fetchPolicy=StoreOrNetwork)
},
~render=props => {
render: props => {
<Layout queryRef=props.prepared> {props.childRoutes} </Layout>
},
)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0ec4a8a

Please sign in to comment.