Skip to content

fix(sql-editor): Bugs and minor improvements #31119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2025
Merged

Conversation

Gilbert09
Copy link
Member

Changes

  • Fixed the height of charts when viewing an insight on the insight view page (e.g. /project/1/insights/Z1k8agnK)
  • Update the locally cached insight value in the editor with the newly incoming version - we sometimes have a stale insight in local storage which wasn't being updated
  • After saving or creating an insight from the editor, remove the tab from the editor (this happens when we redirect out of the editor)
    • I was finding myself with a gazillion tabs open from editing insights which I no longer needed
  • When loading an insight in the editor from another page where the insight had already loaded via dataNodelLogic, don't re-run the query, just use the cached version
    • Even better now that we show how old the query results are in the editor!

@Gilbert09 Gilbert09 requested a review from a team April 11, 2025 12:24
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR addresses several bugs and improves the SQL editor and insight view functionality in PostHog.

  • Fixed chart height rendering on insight view pages by enhancing the presetChartHeight selector in dataVisualizationLogic.ts to properly detect when in the Insight scene
  • Added direct connection to sceneLogic to access activeScene value, replacing the previous approach of finding mounted logic
  • Updated the editor to refresh locally cached insights with newly incoming versions to prevent stale data issues
  • Improved tab management by automatically removing tabs after saving/creating insights when redirecting away from the editor
  • Optimized query execution by using cached results from dataNodeLogic instead of re-running queries unnecessarily
  • Refactored the _deleteTab function to handle cases when Monaco editor is not available

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

Size Change: +369 B (0%)

Total Size: 13.2 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 13.2 MB +369 B (0%)

compressed-size-action

@Gilbert09 Gilbert09 enabled auto-merge (squash) April 11, 2025 14:23
@Gilbert09 Gilbert09 merged commit bcba1ff into master Apr 14, 2025
111 checks passed
@Gilbert09 Gilbert09 deleted the tom/editor-bugs branch April 14, 2025 10:42
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.

2 participants