Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/remove-unused-metadata-references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tauri-apps/api": patch:changes
"tauri": patch:changes
---

Remove references to no longer used `__TAURI_INTERNALS__.metadata.windows` and `__TAURI_INTERNALS__.metadata.webviews`.
2 changes: 1 addition & 1 deletion crates/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions crates/tauri/src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,6 @@ impl<R: Runtime> AppManager<R> {
#[cfg(desktop)]
pub(crate) fn on_webview_close(&self, label: &str) {
self.webview.webviews_lock().remove(label);

if let Ok(webview_labels_array) = serde_json::to_string(&self.webview.labels()) {
let _ = self.webview.eval_script_all(format!(
r#"(function () {{ const metadata = window.__TAURI_INTERNALS__.metadata; if (metadata != null) {{ metadata.webviews = {webview_labels_array}.map(function (label) {{ return {{ label: label }} }}) }} }})()"#,
));
}
}

pub fn windows(&self) -> HashMap<String, Window<R>> {
Expand Down
10 changes: 9 additions & 1 deletion packages/api/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ export default [
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/strict-boolean-expressions': 0,
'no-return-await': 'warn',
'@typescript-eslint/return-await': 'off'
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
]
}
}
]
2 changes: 0 additions & 2 deletions packages/api/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ declare global {
options?: InvokeOptions
}) => void
metadata: {
windows: WindowDef[]
currentWindow: WindowDef
webviews: WebviewDef[]
currentWebview: WebviewDef
}
plugins: {
Expand Down
8 changes: 1 addition & 7 deletions packages/api/src/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,16 @@ export function mockIPC(
* ```
*
* @param current Label of window this JavaScript context is running in.
* @param additionalWindows Label of additional windows the app has.
*
* @since 1.0.0
*/
export function mockWindows(
current: string,
...additionalWindows: string[]
..._additionalWindows: string[]
): void {
mockInternals()
window.__TAURI_INTERNALS__.metadata = {
windows: [current, ...additionalWindows].map((label) => ({ label })),
currentWindow: { label: current },
webviews: [current, ...additionalWindows].map((label) => ({
windowLabel: label,
label
})),
currentWebview: { windowLabel: current, label: current }
}
}
Expand Down