[3.9.1] Crash related to <Text>
See original GitHub issueHey! 👋
I’m getting Error: Couldn't find a Program
after upgrading this package from 3.8.1 to 3.9.1.
Bit of a contrived example below, but seems to reliably trigger the issue and was just about the smallest repro I could manage to find. Not able to post the actual code we’re using I’m afraid but it’s essentially rendering something like:
Total: 12.34
Seems to be something to do with nested text that has a function defined somewhere inside. In our case there’s a reducer for calculating a total.
Some notes:
- Using a named fn instead of the arrow fn still crashes - i.e.
arr.reduce(function add(acc, value) { return acc + value }, 0)
- Replacing the reducer callback with something else like a string prevents the crash - i.e.
arr.reduce('blah', 0)
(obviously invalid code though) - Defining the reducer callback outside of the JSX also prevents the crash - i.e.
const add = (acc, value) => acc + value
andarr.reduce(add, 0)
<- looks like this is a reasonable workaround for now…
Repro code:
const Comp = () => {
return (
<Text>
<Text>Text</Text> {fn(() => {})}
</Text>
)
}
> eslint .
Oops! Something went wrong! :(
ESLint: 7.8.1
Error: Couldn't find a Program
Occurred while linting /Users/REDACTED/REDACTED/REDACTED.tsx:XX
at Scope.getProgramParent (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/scope/index.js:813:11)
at Scope.registerBinding (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/scope/index.js:574:25)
at Scope.crawl (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/scope/index.js:729:14)
at Scope.init (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/scope/index.js:709:12)
at NodePath.setScope (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/path/context.js:131:30)
at NodePath.setContext (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/path/context.js:147:8)
at NodePath.pushContext (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/path/context.js:213:8)
at TraversalContext.visitQueue (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/context.js:100:14)
at TraversalContext.visitMultiple (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/context.js:79:17)
at TraversalContext.visit (/Users/REDACTED/REDACTED/node_modules/@babel/traverse/lib/context.js:138:19)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:32
- Comments:27
Top Results From Across the Web
Developers - [3.9.1] Crash related to <Text> - - Bountysource
[3.9.1] Crash related to <Text> · Using a named fn instead of the arrow fn still crashes - i.e. arr. · Replacing the...
Read more >[Pitfall] In Codeforces Python 3.9.1, calling platform.node() will ...
0 yields correct result, and no crash happens. I wonder how that happens. Perhaps something related to failure of syscall in the virtual...
Read more >Changelog - Onetastic
December 24, 2017 - Version 3.9.1. Fixed a crash while searching in Download Macros window ... Fixed an issue with pages with Linked...
Read more >Progress Energy Levy Units 1 and 2 COLA (Final Safety Analysis ...
3.9-1. 3.9.3.1.2. Loads for Class 1 Components, Core Support, and ... postulated earthquake, and nonstructural partitions in nonsafety-related.
Read more >Cytoscape 3.1.1 constant crashing - Google Groups
Did you try clearing CytoscapeConfiguration? I'm wondering if the issue couple be related to a corrupt cache/settings - if that was the case, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Came up with a workaround 😄
This is still present in 3.11.0.