← Back to community index
# contributor·Active

0hmx - anyone else face this in regular?

anyone else face this in regular?

Started by 0hmxAug 3, 202694 messages

Discussion

Last active last month · plain text
0hmxoriginal post
anyone else face this in regular?
astrimid
Yes, I face this every couple of hours
astrimid
From my react experience, this happens when you wrap hook in a condition
astrimid
So it looks like if there are any errors the ErrorTabComponent exits early and doesn't render anything, but then if error appear while the component is still mounted and there were no error previously, it would crash. If my theory is right, here are steps to reproduce: 1. Make sure there are no errors 2. Open error tab 3. Introduce a code change that triggers an error You should see the error/warning tab crashed
astrimid
First instance of this violation introduced here: https://github.com/tscircuit/runframe/pull/1524 This is a routine problem with react that is fixable by eslint rule `rules-of-hooks`: ``` { "plugins": ["react-hooks"], "rules": { "react-hooks/rules-of-hooks": "error", } } ```
astrimid
the biome equivalent: https://biomejs.dev/linter/rules/use-hook-at-top-level/
astrimid
Shows should be enabled by default
astrimid
https://github.com/tscircuit/runframe/pull/4295 If this fails, it probably means there's something wrong with biome documentation or version or config If this passes, it means, the biome doesn't catch the error, which would mean the problem with either biome not part of CI or ErrorTabComponent is excluded from linting.
astrimid
Ok. It passes. Which makes it more puzzling
astrimid
Ok. I checked the workflow files, and there's no trace of biome running at all, meaning that it's not a part of CI
astrimid
Yeah, biome wasn't running at all: https://github.com/tscircuit/runframe/actions/runs/30852249198/job/91814790604?pr=4296
astrimid
<@757706909351411845> This is a kind of task I would delegate to AI ^
astrimid
But I suspect it would fail meserably
Seve
rules of hooks aren't super great fwiw
Seve
but yea we definitely have some kind of hook issue here
Seve
rules of hooks are difficult to use w/ performance optimizations and it causes a lot of source code inflation
Seve
but we should get to the bottom of this, it is likely just one random hook causing the issue
astrimid
this is not difficult to use at all, this is a basic rule of react
astrimid
this is how react hooks inherently work
astrimid
by design
astrimid
Shared an attachment
Seve
useEffect excessive dependency listing is an example of a major performance issue that rule of hook encourages
Seve
the linting of it is the issue, not the fundamental rules
astrimid
that's a separate lint rule: https://biomejs.dev/linter/rules/use-exhaustive-dependencies/
astrimid
rule of hooks is a basic rule that would cause a component to crash if you don't follow it
astrimid
it is non-negotiable
astrimid
if you don't trust me, ask AI
Seve
it has nothing to do with that
Seve
you're literally referencing some random third party library
Seve
it isn't built into biome
astrimid
sorry, I don't understand
astrimid
I referenced rules-of-hooks because I assumed ESLint is used
Seve
it isn't
astrimid
So I corrected myself and referenced biome rule `use-hook-at-top-level/`
astrimid
which I added to biome.json
astrimid
it still passed
astrimid
so I dug deeper and discovered biome isn't being run at CI at all
astrimid
So I added the workflow to run biome
astrimid
Which expectedly failed with a number of issues
Seve
https://github.com/tscircuit/runframe/blob/main/.github/workflows/bun-formatcheck.yml
Seve
yea you're right i think tho- i don't think we're running linting
Seve
or if we are, we're allowing warnings
astrimid
This only checks formatting
astrimid
like prettier
Seve
but honestly
astrimid
I've literally posted a link with PR that fails linting: https://github.com/tscircuit/runframe/pull/4296
Seve
linting is almost completely useless, the only thing that matters is fixing the bug
astrimid
This bug has been around for a year
Seve
sure
astrimid
Lint would've prevented it since it's trivial
Seve
i doubt that
Seve
but you can try to prove it
Seve
i maintain that linting is not very useful
Seve
not to be overly dick-ish but i absolutely hate linting contribs
Seve
massive waste of time
Seve
if we isolate the bug and prove linting fixes it then i think we would at least force the linting rule that fixed it into CI, but i don't think linting will catch it
Seve
for additional clarity, linting contribs plagued this project for a long time and we banned them, because they create far more bugs than they solve
Seve
you can imagine these are the easiest to ai contrib
Seve
even this i doubt is the root cause
astrimid
Shared an attachment
Seve
how was this reproduced?
astrimid
what exactly?
Seve
^
Seve
the error tab content has an obvious bug, but i'm not sure that's the actual root cause (hopefully it is)
astrimid
It's literally written on the screenshot "rendered fewer hooks than expected". This is an error message from react
Seve
yes we all know that is the error
astrimid
any time you change number of hooks by changing the conditional
Seve
how do you reproduce it is the question
astrimid
check the conditional
Seve
haha
Seve
dude
astrimid
try to change it with component still visible
Seve
we are some of the only people who have written a react fiber layer in the world
Seve
we know react extremely well
Seve
we know exactly how hooks work
Seve
the question is how does a user reproduce the issue
Seve
i.e. what action do they perform in RunFrame or with their circuit that causes this error page to appear
Seve
https://github.com/tscircuit/runframe/pull/4297
Seve
^ i'm suggesting that this is not the root cause
astrimid
I've posted the steps at the very start of the thread: 1. Create a circuit that doesn't cause any warnings or errors 2. Make sure the errors tab is open 3. Introduce a warning or error 4. Fix that warning or eror
astrimid
Shared an attachment
astrimid
It's not that hard for a person who knows react really well
astrimid
what's hard is producing tsx circuit that has no warnings or errors
Seve
https://github.com/tscircuit/schematic-viewer/pull/248/files
astrimid
The lint error is gone
astrimid
So it was the only occurrence in runframe
Seve
check out the schematic-viewer PR, that is also an out of order issue- but not one a linter picks up
Seve
then you can introduce stuff like this that makes it easier to debug these failures with the actual components causing the issue https://github.com/tscircuit/runframe/pull/4304
astrimid
This also looks like something biome would pick up, this is pretty mechanical: the code should not contain `use*` function after conditional return statements, there should be no conditionals at all between `use*` function calls.
Seve
🤷
astrimid
FYI in production this would be useless
astrimid
unless keepNames is true
Seve
yes perhaps!

Want to add to the conversation?

Reply in Discord so your notes stay connected to the source.
Continue in Discord ↗