Repository navigation
fix(site): show available logs consistently on template creation page - #19832
Conversation
…mplate creation page
buenos-nachos
left a comment
There was a problem hiding this comment.
Conditional logic looks right to me, but the effects have me concerned
|
after staring at this for a while, I realized that the effects were weird because they're just in the wrong place. 😅 aaand that every place that uses this component re-implements the autoscrolling behavior itself. it should really just scroll itself, and that makes a bunch of complexity vanish. |
buenos-nachos
left a comment
There was a problem hiding this comment.
I think this makes sense for a stopgap. I'm just not a fan of the random logs expression used to suppress the Biome warnings
|
|
||
| const ref = useRef<HTMLDivElement>(null); | ||
| useLayoutEffect(() => { | ||
| logs; |
There was a problem hiding this comment.
This feels janky to me. I think I'd rather have the Biome warning suppression, because it feels more "honest" about this not being a properly-defined synchronization effect
I think there's a "deeper" fix we can reach for to remove the effect entirely. I just don't know if it makes to do it now. For BuildLogsDrawer at least, we could:
- Update the logs component to accept a forwarded ref, and get rid of the old ref + layout logic
- Define the ref in
BuildLogsDrawer - Update
useWatchVersionLogsto accept anonMessagecallback that fires each time a new message comes in - Have
BuildLogsDrawerpass the ref down to the logs component, and also pass anonMessagecallback to the hook that handles the scrolling behavior
There was a problem hiding this comment.
The big problem right now is that ideally these scrolls would be handled in an event handler, but the state isn't defined in a way that gives you a state setter function that's easy to wrap
Plus, there's five components currently using this
There was a problem hiding this comment.
one day we'll get signals...
There was a problem hiding this comment.
I mean, the problem with the React team is that they legitimately think that they don't need signals, and that the compiler is going to solve all of React's problems (which it probably won't). They've turned down a few signal proposals already
There was a problem hiding this comment.
it'll take a while, but I'm pretty sure the web platform will get signals soon, and then the react team will be forced to reckon with them.
also preact even jumped the gun and added signals. angular has signals now. the tide is turning!
Closes #19704
The condition on this page was subtly wrong in a very annoying way. :^)