pnp / pnp/sp-dev-fx-controls-react
ListItemComments: Hooks can only be called inside of the body of a function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 433
- Forks
- 418
- Avg merge
- 5d 6m
- Merged PRs (30d)
- 19
Description
Category
- Bug
Version
Please specify what version of the library you are using: 3.12.0
- SPFx: 1.16.1
- React: 17.0.2
- FluentUI: 8.105.3
Expected / Desired Behavior / Question
Control should be rendered
Observed Behavior
White SPFx extension screen. Browser console shows Error: Hooks can only be called inside of the body of a function
I don´t know what is realy causing the issue. I copied the source code of listItemComment and LivePersona controls into the project where it is used. Then I fixed a bunch of
- type issues (project is running in strict-mode)
- rules-of-hooks errors (missing dependencies in useEffect; changing objects instead of Memos)
- async/await vs promise/callback mixes
After that, the error was gone.
I forked the sp-dev-fx-controls-react dev-branch but can´t get npm ci or npm i running because of conflicting peer dependencies.
Because of that, I only copied the updated controls of the project into the fork: https://github.com/trueleader/sp-dev-fx-controls-react/commit/f2519f179bb49513eb3c97f75c0e637131345394
The project has other code-style-settings, thats why my fork commit shows many more differences.
Don´t know if this will help someone.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the ListItemComments and LivePersona controls, then compare them with the updated copies in commit f2519f179bb49513eb3c97f75c0e637131345394. Reproduce the issue using React 17.0.2, FluentUI 8.105.3, and SPFx 1.16.1; done means the control renders without the hooks error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100