feat: import QGIS project files - #1563
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds QGS and QGZ project import support. The importer restores supported project metadata, views, layers, groups, paths, styles, and labels. Desktop wiring adds file selection, import actions, localized warnings, raster authorization, and validation tests. ChangesQGIS project import
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant ProjectMenu
participant FilePicker
participant Importer
participant ProjectState
participant ResultDialog
User->>ProjectMenu: Select Import QGIS Project
ProjectMenu->>FilePicker: Open .qgs or .qgz picker
FilePicker-->>ProjectMenu: Return file data and path
ProjectMenu->>Importer: Parse and materialize project layers
Importer-->>ProjectMenu: Return GeoLibre project and warnings
ProjectMenu->>ProjectState: Load project as dirty
ProjectState-->>ResultDialog: Provide import warnings
ResultDialog-->>User: Show completion status and warning details
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Cloudflare PR preview
|
🔍 GitHub Pages PR preview
|
Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
|
All four inline comments posted successfully. Code reviewBugs
Quality
CLAUDE.md / Security / Performance
The core conversion logic (extent/CRS handling, group flattening into single-level display names, visibility, opacity, layer ordering, and the reload path integration via |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/qgis-project-import.test.ts`:
- Around line 20-39: Extend the QGIS project fixture generation and coverage
around importQgisProject to include supported raster map layers alongside the
existing vector layers. Add a raster conversion path that restores each raster’s
source, visible state, opacity, beforeId, and groupId, while retaining the
“non-vector” warning for unsupported layer types; update the test to assert all
five restored raster properties.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: dab1e8bc-91af-4cc9-a196-5c2de56627ee
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (10)
apps/geolibre-desktop/src/components/layout/TopToolbar.tsxapps/geolibre-desktop/src/components/layout/toolbar/ProjectFileDialogs.tsxapps/geolibre-desktop/src/components/layout/toolbar/ProjectMenu.tsxapps/geolibre-desktop/src/hooks/useProjectFileActions.tsapps/geolibre-desktop/src/i18n/locales/en.jsonapps/geolibre-desktop/src/lib/qgis-project-import.tsapps/geolibre-desktop/src/lib/tauri-io.tsapps/geolibre-desktop/src/lib/ui-profile.tspackage.jsontests/qgis-project-import.test.ts
|
All four inline comments posted. Now the final summary. Code reviewSecurity
Bugs
Quality
No findings under Performance or CLAUDE.md beyond the maintainability point above; the new i18n keys, menu wiring, |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/geolibre-desktop/src/lib/qgis-project-import.ts`:
- Around line 44-63: Update the remote-layer processing in
handleImportQgisProject to use bounded concurrency instead of launching every
request through Promise.all at once. Add a per-request timeout or cancellation
deadline to fetcher calls, and ensure timed-out requests follow the existing
catch path that records failedLayerIds and the "remote-file" warning while
allowing other layers to import.
In `@tests/qgis-project-import.test.ts`:
- Around line 143-168: Extend the test around materializeQgisRemoteLayers to
place successful and failed remote layers in the same layerGroups entry, then
assert the failed layer is removed while the group and successful layer remain.
Also cover a group containing only failed layers and assert that unused group
cleanup removes it if that behavior is part of the contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 900a55af-287c-4c83-87c1-00ccf2e4268e
📒 Files selected for processing (3)
apps/geolibre-desktop/src/hooks/useProjectFileActions.tsapps/geolibre-desktop/src/lib/qgis-project-import.tstests/qgis-project-import.test.ts
Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
Code reviewSecurity
Bugs
Quality
Performance / CLAUDE.md
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/geolibre-desktop/src/hooks/useProjectFileActions.ts (1)
188-240: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPrevent overlapping QGIS imports.
handleImportQgisProjecthas several awaited operations before it updates the store. If two imports overlap, the older import can finish last and load its project or add rasters into the newer project.Serialize imports with a ref-based guard, or use an import generation token before every project-state mutation.
Proposed guard
+ const isImportingQgisRef = useRef(false); + const handleImportQgisProject = async () => { + if (isImportingQgisRef.current) return; + isImportingQgisRef.current = true; const result = await openQgisProjectFile(); - if (!result) return; + if (!result) { + isImportingQgisRef.current = false; + return; + } try { // import work } catch (error) { // existing error handling + } finally { + isImportingQgisRef.current = false; } };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/geolibre-desktop/src/hooks/useProjectFileActions.ts` around lines 188 - 240, Prevent concurrent executions of handleImportQgisProject by adding a ref-based in-progress guard around the full import flow. Return immediately when an import is already active, set the guard before the first awaited operation, and clear it in a finally block so failures or cancellations do not leave imports permanently blocked; ensure project loading, raster additions, and store updates occur only for the active import.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/geolibre-desktop/src/hooks/useProjectFileActions.ts`:
- Around line 188-240: Prevent concurrent executions of handleImportQgisProject
by adding a ref-based in-progress guard around the full import flow. Return
immediately when an import is already active, set the guard before the first
awaited operation, and clear it in a finally block so failures or cancellations
do not leave imports permanently blocked; ensure project loading, raster
additions, and store updates occur only for the active import.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3fb9d896-6881-4359-af52-6639f5283d0a
📒 Files selected for processing (5)
apps/geolibre-desktop/src-tauri/src/lib.rsapps/geolibre-desktop/src/components/layout/toolbar/ProjectFileDialogs.tsxapps/geolibre-desktop/src/hooks/useProjectFileActions.tsapps/geolibre-desktop/src/i18n/locales/en.jsonapps/geolibre-desktop/src/lib/tauri-io.ts
💤 Files with no reviewable changes (1)
- apps/geolibre-desktop/src/i18n/locales/en.json
Code reviewBugs
Security
Quality
CLAUDE.md
|
|
Now composing the final summary. Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
Summary
.qgsand.qgzprojects into GeoLibre projectsVerification
npm run build -w geolibre-desktopnpm run test:frontend(4,407 passed, 1 skipped)pre-commit run --files ....qgsand.qgzfixtures in light and dark themesFixes #1562
Summary by CodeRabbit
.qgsand.qgzprojects.