acdlite / acdlite/flummox-isomorphic-demo
`performRouteHandlerStaticMethod` doesn't work with decorators
- Langage dominant
- JavaScript
- Étoiles
- 89
- Forks
- 17
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
`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?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react
- Domaine
- frontend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100