Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Incorrect useRef usage (with merged conflicts resolved) #143

Merged
merged 6 commits into from
May 26, 2022

Conversation

MichelML
Copy link
Contributor

@MichelML MichelML commented May 25, 2022

From @wanjas

Fixes this issue #83

If an array is passed as percent prop and its length is changed dynamically, 'Rendered more hooks than during the previous render' react error appears.

The issue was in incorrect useRef usage silenced by // eslint-disable-next-line react-hooks/rules-of-hooks

I believe now it works correctly without any change of actual logic.

I've added 1 test and altered the 'gap' example a bit to check if it is working correctly.

close #83
close #126

@vercel
Copy link

vercel bot commented May 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
progress ✅ Ready (Inspect) Visit Preview May 25, 2022 at 7:21PM (UTC)

@yoyo837 yoyo837 requested a review from afc163 May 26, 2022 01:39
@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #143 (e9d7ed0) into master (fc6ba0b) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #143      +/-   ##
==========================================
+ Coverage   99.13%   99.15%   +0.02%     
==========================================
  Files           4        4              
  Lines         115      118       +3     
  Branches       35       35              
==========================================
+ Hits          114      117       +3     
  Misses          1        1              
Impacted Files Coverage Δ
src/Circle.tsx 100.00% <100.00%> (ø)
src/Line.tsx 100.00% <100.00%> (ø)
src/common.ts 94.44% <100.00%> (-0.30%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@wanjas
Copy link
Contributor

wanjas commented May 26, 2022

Thanks for resolving the conflict but I think a change of the name in package.json 89d704c is unnecessary

@afc163 afc163 merged commit 6241fd1 into react-component:master May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendered more hooks than during the previous render
4 participants