Skip to content

Conversation

@andrewvarga
Copy link
Contributor

@andrewvarga andrewvarga commented Nov 28, 2025

Fixes #7012

Could be reproduced by having a project which has an import:

import "cube.kcl" as cube
cube
  |> translate(
       %,
       x = 5.14,
       y = 2.14,
       z = 1.14,
     )

Make sure you have the file being imported "cube.kcl" in this case that can contain anything:

sketch001 = startSketchOn(XZ)
profile001 = startProfile(sketch001, at = [-2, 2])
  |> yLine(length = -4)
  |> xLine(length = 4)
  |> yLine(length = 4)
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
  |> close()
extrude001 = extrude(profile001, length = 4)

Then:

  • toggle "Show scale grid" either via command bar settings or user settingg: this will work
  • toggle it again: this will not work
  • change anything in the kcl code to cause re-execution (eg. change a number) -> grid will update properly

I was trying to add a test, it was a bit tricky for me at first without using a screenshot based test or without using mocks..

@andrewvarga andrewvarga requested a review from a team as a code owner November 28, 2025 15:20
@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
modeling-app Ready Ready Preview Comment Nov 28, 2025 3:58pm

@andrewvarga andrewvarga changed the title #7012 Fix can't turn grid off #7012 Fix: Can't turn grid off Nov 28, 2025
{
.is_ok()
{
cache::write_old_ast(GlobalState::with_settings(
Copy link
Contributor Author

@andrewvarga andrewvarga Nov 28, 2025

Choose a reason for hiding this comment

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

Previously we never called write_old_ast in this CheckImportsOnly arm of the match after reapply_settings so the value was never updated in the cache, so next time the grid changed it was compared against an outdated cached value.

This is similar code to further below in this function which also calls write_old_ast after reapply_settings.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 28, 2025

CodSpeed Performance Report

Merging #9101 will not alter performance

Comparing andrewvarga/7012/fix-cant-turn-grid-off (15f97b0) with main (b7b0f68)1

Summary

✅ 143 untouched
🆕 2 new
⏩ 92 skipped2

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
🆕 Simulation parse_crash-box N/A 33.1 ms N/A
🆕 Simulation parse_hex-nut-with-chamfer N/A 13.6 ms N/A

Footnotes

  1. No successful run was found on main (8506634) during the generation of this report, so b7b0f68 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 92 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't Turn Grid Off

2 participants