Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

[BUG] Skipping the last item causes an error #498

Closed
HarikalarKutusu opened this issue Oct 27, 2021 · 3 comments
Closed

[BUG] Skipping the last item causes an error #498

HarikalarKutusu opened this issue Oct 27, 2021 · 3 comments
Assignees
Labels

Comments

@HarikalarKutusu
Copy link
Contributor

HarikalarKutusu commented Oct 27, 2021

While testing localization manually, I stumbled over this one.

To test:

  1. Add 2-3 sentences
  2. Skip them when reviewing
  3. After the last item it gives error (but continues to work).

Console output in production (Windows/Chrome):

main.js:2 Error: Minified React error #300; visit https://reactjs.org/docs/error-decoder.html?invariant=300 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at ri (main.js:2)
at Fi (main.js:2)
at Vl (main.js:2)
at xu (main.js:2)
at ku (main.js:2)
at Eu (main.js:2)
at pu (main.js:2)
at main.js:2
at t.unstable_runWithPriority (main.js:2)
at Bo (main.js:2)

Console output in local (Ubuntu/Firefox):

Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
React 12
unstable_runWithPriority scheduler.development.js:468
React 5
handleSwipe review-form.tsx:64
onSwipe review-form.tsx:167
swipe index.js:140
_callee2$ review-form.tsx:109
tryCatch runtime.js:63
invoke runtime.js:294
defineIteratorMethods runtime.js:119
__awaiter main.js:3078
__awaiter main.js:3057
processButtonPressOnCurrentCard review-form.tsx:98
handler review-form.tsx:124
SwipeReview review-form.tsx:128
React 5
unstable_runWithPriority scheduler.development.js:468
React 3
workLoop scheduler.development.js:417
flushWork scheduler.development.js:390
performWorkUntilDeadline scheduler.development.js:157
js scheduler.development.js:180
js scheduler.development.js:645
Webpack 11
react-dom.development.js:15050
The above error occurred in the component:

SwipeReview@http://localhost:3333/main.js:3092:16
div
Review@http://localhost:3333/main.js:3444:15
Route@http://localhost:3333/main.js:39000:29
PrivateRoute@http://localhost:3333/main.js:1045:16
Switch@http://localhost:3333/main.js:39206:29
main
Page@http://localhost:3333/main.js:2580:18
Router@http://localhost:3333/main.js:38629:30
ConnectedRouter@http://localhost:3333/main.js:4652:22
ConnectedRouterWithContext@http://localhost:3333/main.js:4776:19
ConnectFunction@http://localhost:3333/main.js:36799:68
App@http://localhost:3333/main.js:968:17
LocalizationProvider@http://localhost:3333/main.js:49310:9
AppLocalizationProvider@http://localhost:3333/main.js:4104:66
PersistGate@http://localhost:3333/main.js:42373:20
Provider@http://localhost:3333/main.js:36513:15
Store@http://localhost:3333/main.js:4547:17
Root

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries. react_devtools_backend.js:2528:25
Uncaught (in promise) Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
React 12
unstable_runWithPriority scheduler.development.js:468
React 5
handleSwipe review-form.tsx:64
onSwipe review-form.tsx:167
swipe index.js:140
_callee2$ review-form.tsx:109
tryCatch runtime.js:63
invoke runtime.js:294
defineIteratorMethods runtime.js:119
__awaiter main.js:3078
__awaiter main.js:3057
processButtonPressOnCurrentCard review-form.tsx:98
handler review-form.tsx:124
SwipeReview review-form.tsx:128
React 5
unstable_runWithPriority scheduler.development.js:468
React 3
workLoop scheduler.development.js:417
flushWork scheduler.development.js:390
performWorkUntilDeadline scheduler.development.js:157
js scheduler.development.js:180
js scheduler.development.js:645
Webpack 11
react-dom.development.js:15050

@HarikalarKutusu HarikalarKutusu changed the title [BUG] Skipping last item causes a crash [BUG] Skipping the last item causes a crash Oct 27, 2021
@HarikalarKutusu HarikalarKutusu changed the title [BUG] Skipping the last item causes a crash [BUG] Skipping the last item causes an error Oct 28, 2021
@HarikalarKutusu
Copy link
Contributor Author

Correction: It also happens in other combinations, not only in skip. On this line:

await cardsRefs[currentSentenceIndex].current.swipe(direction);

@MichaelKohler MichaelKohler self-assigned this Oct 28, 2021
@MichaelKohler
Copy link
Member

Thanks for filing this, nice catch! This is definitely a bug I introduced quite some time ago. Good that you found it!

I usually would tag this as "good first issue" for someone else to fix, but in this case the impact is quite bad, so I'm gonna fix this right now.

HarikalarKutusu pushed a commit to HarikalarKutusu/sentence-collector that referenced this issue Oct 28, 2021
MichaelKohler pushed a commit that referenced this issue Oct 31, 2021
# [2.12.0](v2.11.3...v2.12.0) (2021-10-31)

### Bug Fixes

* always link to localized URL (fixes [#504](#504)) ([#512](#512)) ([6e66528](6e66528))
* do not use locale prefixed URLs for login/logout ([#506](#506)) ([02053a4](02053a4))
* fix empty page after reviewing last sentence (fixes [#498](#498)) ([728f429](728f429))
* fix typo in sc-lang-info-left-for-you ([#515](#515)) ([313273f](313273f))
* fix upperkey keys not working in Review (fixes [#487](#487)) ([#508](#508)) ([6c3a073](6c3a073))
* make duplicate sentences use plural rules ([#511](#511)) ([ab2c696](ab2c696))
* move LocalizationProvider outwards to not request language on every page navigation ([6a5967e](6a5967e))
* only expose error codes ([2114b38](2114b38))
* show 'Add more sentences' link in stats when no more to review for user ([#516](#516)) ([ae9f1cf](ae9f1cf))
* show native language name only in stats (issue [#492](#492)) ([#514](#514)) ([0086c64](0086c64))
* slight font adjustments ([#505](#505)) ([25ca2e0](25ca2e0))

### Features

* localization: extract English strings into FTL file ([#507](#507)) ([6d64afb](6d64afb)), closes [#501](#501)
@MichaelKohler
Copy link
Member

🎉 This issue has been resolved in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants