Skip to content

Conversation

@IanMayo
Copy link
Member

@IanMayo IanMayo commented Aug 29, 2025

Summary

Fixes Issue #7: "Plot JSON Editor: Map resets to London and loses features when tab loses/regains focus"

This PR resolves the VS Code webview state persistence issue where the Plot JSON Editor map would reset to London coordinates and lose all GeoJSON features when switching between tabs.

Key Changes

  • Map State Persistence: Implemented per-file map view state management (center position and zoom level)
  • Smart Tab Restoration: Added logic to distinguish between tab activation vs tab restoration from hidden state
  • Immediate Feature Loading: Enhanced webview lifecycle to force document updates when tabs are restored
  • Optimized Performance: State restoration happens immediately without visual delays or double animations
  • Multi-File Support: Each plot file maintains independent state without interference

Technical Implementation

  • TypeScript: Enhanced PlotJsonEditorProvider with state management and improved onDidChangeViewState handling
  • JavaScript: Added proactive state saving on map interactions and intelligent restoration logic
  • Performance: Skip fitBounds when saved state exists to prevent visual flicker

Files Modified

  • src/plotJsonEditor.ts - Enhanced webview lifecycle management with state persistence
  • media/plotJsonEditor.js - Added state save/restore functionality and optimized restoration timing

Test Plan

  • Single plot files restore correctly after tab switches
  • Multiple plot files maintain independent states
  • Map position and zoom level preserved across tab switches
  • GeoJSON features display immediately on tab restoration
  • No visual delays or panning animations during restoration
  • Feature selections maintained across tab switches
  • No interference when switching between visible tabs

Before/After

Before: Tab switches → map resets to London with no features visible
After: Tab switches → map maintains position, zoom level, and displays all features instantly

Closes #7

@IanMayo IanMayo changed the base branch from main to tap-debrief-ws-bridge-notify August 29, 2025 11:23
Base automatically changed from tap-debrief-ws-bridge-notify to main August 29, 2025 11:23
@github-actions
Copy link

github-actions bot commented Aug 29, 2025

🚀 PR Preview Deployed

Your PR preview has been successfully deployed to Fly.io!

🌐 Preview URL: https://pr-8-futuredebrief.fly.dev

📋 Details:

🔧 What's included:

  • VS Code (code-server) environment
  • Debrief extension pre-installed
  • Sample workspace with test files

💡 How to use:

  1. Click the preview URL above
  2. Open any .plot.json file to test the custom editor
  3. Use Ctrl+Shift+P to access extension commands
  4. Check the Explorer panel for the "Hello World" view

This preview will be automatically updated when you push new commits to this PR.

@IanMayo IanMayo merged commit 6aba2ef into main Aug 29, 2025
2 checks passed
@IanMayo IanMayo deleted the issue-7-plot-json-editor-map-resets-to-london branch August 29, 2025 12:22
@github-actions
Copy link

🧹 PR Preview Cleaned Up

Your PR preview environment has been automatically destroyed.

✅ Cleanup successful!

All associated resources have been removed from Fly.io to optimize costs.

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.

Plot JSON Editor: Map resets to London and loses features when tab loses/regains focus

2 participants