In Stage 4 (Profile Calculation), selecting "Custom (.sp)" under Substrate OBA / FWA Compensation and clicking the "Browse..." button (btnBrowseCustomSp) throws an unhandled JavaScript exception and fails to open a file picker dialog.
Details & Root Cause
In src/js/colprof.js (lines 54–66):
if(btnBrowseCustomSp&&colprofCustomSpPath){btnBrowseCustomSp.addEventListener("click",async()=>{try{constselected=awaitwindow.__TAURI__.dialog.open({filters:[{name:'Spectrum',extensions:['sp']}]});if(selected){colprofCustomSpPath.value=selected;}}catch(err){console.error("Failed to open dialog:",err);}});}
In Tauri v2 with withGlobalTauri: true, window.__TAURI__.dialog is undefined because @tauri-apps/plugin-dialog is not exposed as a frontend global. File picker dialogs in ICCery are handled via backend IPC commands using app.dialog().file() (e.g. select_profile_file, select_target_file, select_csv_save_path). There is currently no backend command for selecting .sp spectrum files.
Steps to Reproduce
Launch ICCery and proceed to Stage 4 (Create Profile).
Set "Substrate OBA / FWA Compensation" to "Custom (.sp)".
Click "Browse...".
Observe that no dialog opens, and devtools console logs: TypeError: Cannot read properties of undefined (reading 'open').
Proposed Remediation
Add a Tauri command select_spectrum_file in src-tauri/src/commands.rs calling app.dialog().file().add_filter("Spectrum File (.sp)", &["sp"]).pick_file(...).
Register select_spectrum_file in src-tauri/src/lib.rs.
Update src/js/colprof.js to invoke select_spectrum_file.
### Summary
In Stage 4 (Profile Calculation), selecting "Custom (.sp)" under Substrate OBA / FWA Compensation and clicking the "Browse..." button (`btnBrowseCustomSp`) throws an unhandled JavaScript exception and fails to open a file picker dialog.
### Details & Root Cause
In `src/js/colprof.js` (lines 54–66):
```javascript
if (btnBrowseCustomSp && colprofCustomSpPath) {
btnBrowseCustomSp.addEventListener("click", async () => {
try {
const selected = await window.__TAURI__.dialog.open({
filters: [{ name: 'Spectrum', extensions: ['sp'] }]
});
if (selected) {
colprofCustomSpPath.value = selected;
}
} catch (err) {
console.error("Failed to open dialog:", err);
}
});
}
```
In Tauri v2 with `withGlobalTauri: true`, `window.__TAURI__.dialog` is undefined because `@tauri-apps/plugin-dialog` is not exposed as a frontend global. File picker dialogs in ICCery are handled via backend IPC commands using `app.dialog().file()` (e.g. `select_profile_file`, `select_target_file`, `select_csv_save_path`). There is currently no backend command for selecting `.sp` spectrum files.
### Steps to Reproduce
1. Launch ICCery and proceed to Stage 4 (Create Profile).
2. Set "Substrate OBA / FWA Compensation" to "Custom (.sp)".
3. Click "Browse...".
4. Observe that no dialog opens, and devtools console logs: `TypeError: Cannot read properties of undefined (reading 'open')`.
### Proposed Remediation
1. Add a Tauri command `select_spectrum_file` in `src-tauri/src/commands.rs` calling `app.dialog().file().add_filter("Spectrum File (.sp)", &["sp"]).pick_file(...)`.
2. Register `select_spectrum_file` in `src-tauri/src/lib.rs`.
3. Update `src/js/colprof.js` to invoke `select_spectrum_file`.
Implemented select_spectrum_file Tauri command in src-tauri/src/commands.rs with .sp filter wrapping app.dialog().file().pick_file(...).
Registered select_spectrum_file in the Tauri invoke handler in src-tauri/src/lib.rs.
Updated src/js/colprof.jsbtnBrowseSpectrum event handler to invoke select_spectrum_file passing the current working directory, populating the input and setting wizardState.customSpectrumPath.
Verified backend compilation and all 91 cargo unit tests pass.
Resolved in commit `5a1ad65` on `development`.
- Implemented `select_spectrum_file` Tauri command in `src-tauri/src/commands.rs` with `.sp` filter wrapping `app.dialog().file().pick_file(...)`.
- Registered `select_spectrum_file` in the Tauri invoke handler in `src-tauri/src/lib.rs`.
- Updated `src/js/colprof.js` `btnBrowseSpectrum` event handler to invoke `select_spectrum_file` passing the current working directory, populating the input and setting `wizardState.customSpectrumPath`.
- Verified backend compilation and all 91 cargo unit tests pass.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
In Stage 4 (Profile Calculation), selecting "Custom (.sp)" under Substrate OBA / FWA Compensation and clicking the "Browse..." button (
btnBrowseCustomSp) throws an unhandled JavaScript exception and fails to open a file picker dialog.Details & Root Cause
In
src/js/colprof.js(lines 54–66):In Tauri v2 with
withGlobalTauri: true,window.__TAURI__.dialogis undefined because@tauri-apps/plugin-dialogis not exposed as a frontend global. File picker dialogs in ICCery are handled via backend IPC commands usingapp.dialog().file()(e.g.select_profile_file,select_target_file,select_csv_save_path). There is currently no backend command for selecting.spspectrum files.Steps to Reproduce
TypeError: Cannot read properties of undefined (reading 'open').Proposed Remediation
select_spectrum_fileinsrc-tauri/src/commands.rscallingapp.dialog().file().add_filter("Spectrum File (.sp)", &["sp"]).pick_file(...).select_spectrum_fileinsrc-tauri/src/lib.rs.src/js/colprof.jsto invokeselect_spectrum_file.Resolved in commit
5a1ad65ondevelopment.select_spectrum_fileTauri command insrc-tauri/src/commands.rswith.spfilter wrappingapp.dialog().file().pick_file(...).select_spectrum_filein the Tauri invoke handler insrc-tauri/src/lib.rs.src/js/colprof.jsbtnBrowseSpectrumevent handler to invokeselect_spectrum_filepassing the current working directory, populating the input and settingwizardState.customSpectrumPath.