acdlite / acdlite/flummox-isomorphic-demo
`performRouteHandlerStaticMethod` doesn't work with decorators
- Lenguaje dominante
- JavaScript
- Estrellas
- 89
- Forks
- 17
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
`await performRouteHandlerStaticMethod(state.routes, 'routerWillRun', routeHandlerInfo)`
```
export default async function performRouteHandlerStaticMethod(routes, methodName, ...args) {
return Promise.all(routes
.map(route => {route.handler[methodName]; console.log(route, route.handler)})
.filter(method => typeof method === 'function')
.map(method => method(...args))
);
}
```
This doesn't work when you use decorators around your components. E.g. I wrapped my components when using `react-dnd` and `route.handler` is the `DragAndDropContainer`.
Is their a better approach?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Look at the performRouteHandlerStaticMethod function in the codebase to see how it accesses route.handler. The issue is that decorators like react-dnd wrap the component, so route.handler is the wrapper, not the original component. Check how routes are defined and where handlers are set. The fix likely involves unwrapping the decorated component to access its static methods. Test by creating a route with a decorated component and seeing what route.handler contains.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100