Skip to content

fix(site): show available logs consistently on template creation page - #19832

Merged
aslilac merged 10 commits into
mainfrom
lilac/fix-bad-logging-conditions
Sep 16, 2025
Merged

aslilac merged 10 commits into
mainfrom
lilac/fix-bad-logging-conditions

Conversation

@aslilac

@aslilac aslilac commented Sep 15, 2025 •

Copy link
Copy Markdown
Member

Closes #19704

The condition on this page was subtly wrong in a very annoying way. :^)

@buenos-nachos buenos-nachos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional logic looks right to me, but the effects have me concerned

@buenos-nachos buenos-nachos changed the title fix: show logs consistently when there are logs to be shown on the template creation page fix(site): show available logs consistently on template creation page Sep 16, 2025
@aslilac

aslilac commented Sep 16, 2025 •

Copy link
Copy Markdown
Member Author

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 buenos-nachos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

@buenos-nachos buenos-nachos Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Update the logs component to accept a forwarded ref, and get rid of the old ref + layout logic
  2. Define the ref in BuildLogsDrawer
  3. Update useWatchVersionLogs to accept an onMessage callback that fires each time a new message comes in
  4. Have BuildLogsDrawer pass the ref down to the logs component, and also pass an onMessage callback to the hook that handles the scrolling behavior

@buenos-nachos buenos-nachos Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one day we'll get signals...

@buenos-nachos buenos-nachos Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@aslilac aslilac Sep 16, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@aslilac
aslilac merged commit f5fac29 into main Sep 16, 2025
@aslilac
aslilac deleted the lilac/fix-bad-logging-conditions branch September 16, 2025 20:33
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Web UI does not surface errors in template creation

2 participants