Repository: gradio-app/gradio

Issue:
The progress bar still exists when the backend raise an error
### Describe the bug

In the previous version (5.12.0), when an error was raised, the progress bar would immediately disappear and display a closable alert.

gradio 5.20.0
![Image](https://github.com/user-attachments/assets/62fb676a-ea14-42a3-9519-aa0668213a1e)

gradio 5.12.0
![Image](https://github.com/user-attachments/assets/f18d2ba3-a7b9-4d01-905d-7fbb37da031c)

### Have you searched existing issues?  🔎

- [x] I have searched and found no existing issues

### Reproduction

```python
import gradio as gr


def submit(input_value):
    raise gr.Error("test")


with gr.Blocks() as demo:
    chatbot = gr.Chatbot()
    input = gr.Textbox()
    input.submit(submit, inputs=input, outputs=[input, chatbot])

demo.launch()
```


### Screenshot

_No response_

### Logs

```shell

```

### System Info

```shell
gradio version: 5.20.0
gradio_client version: 1.7.2
```

### Severity

Blocking usage of gradio

Discussion:
@abidlabs: Yeah I just noticed this as well, thanks @Col0ring for raising this issue

Solution patch:
diff --git a/.changeset/common-nails-divide.md b/.changeset/common-nails-divide.md
new file mode 100644
index 000000000..90acfdb63
--- /dev/null
+++ b/.changeset/common-nails-divide.md
@@ -0,0 +1,5 @@
+---
+"gradio": patch
+---
+
+fix: Check for Node.js path only if SSR mode is true.
diff --git a/.changeset/khaki-pillows-send.md b/.changeset/khaki-pillows-send.md
new file mode 100644
index 000000000..970e954af
--- /dev/null
+++ b/.changeset/khaki-pillows-send.md
@@ -0,0 +1,6 @@
+---
+"@gradio/chatbot": patch
+"gradio": patch
+---
+
+fix:Fix Chatbot avatar image position
diff --git a/.changeset/orange-dragons-rescue.md b/.changeset/orange-dragons-rescue.md
new file mode 100644
index 000000000..390bb0676
--- /dev/null
+++ b/.changeset/orange-dragons-rescue.md
@@ -0,0 +1,7 @@
+---
+"@gradio/client": patch
+"@gradio/core": patch
+"gradio": patch
+---
+
+fix:Fix error display
diff --git a/.changeset/pink-snails-arrive.md b/.changeset/pink-snails-arrive.md
new file mode 100644
index 000000000..50a36ad56
--- /dev/null
+++ b/.changeset/pink-snails-arrive.md
@@ -0,0 +1,5 @@
+---
+"gradio": minor
+---
+
+feat:Add `pwa` and `enable_monitoring` parameters to `mount_gradio_app`
diff --git a/client/js/src/client.ts b/client/js/src/client.ts
index 5654dd630..86569b2e5 100644
--- a/client/js/src/client.ts
+++ b/client/js/src/client.ts
@@ -55,6 +55,7 @@ export class Client {
 
 	// streaming
 	stream_status = { open: false };
+	closed = false;
 	pending_stream_messages: Record<string, any[][]> = {};
 	pending_diff_streams: Record<string, any[][]> = {};
 	event_callbacks: Record<string, (data?: unknown) => Promise<void>> = {};
@@ -274,6 +275,7 @@ export class Client {
 	}
 
 	close(): void {
+		this.closed = true;
 		close_stream(this.stream_status, this.abort_controller);
 	}
 
diff --git a/gradio/blocks.py b/gradio/blocks.py
index 4dccd587f..78ed259a3 100644
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -2556,10 +2556,10 @@ Received inputs:
                 else os.getenv("GRADIO_SSR_MODE", "False").lower() == "true"
             )
         )
-        self.node_path = os.environ.get(
-            "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
-        )
         if self.ssr_mode:
+            self.node_path = os.environ.get(
+                "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
+            )
             self.node_server_name, self.node_process, self.node_port = (
                 start_node_server(
                     server_name=node_server_name,
diff --git a/gradio/routes.py b/gradio/routes.py
index 4c9d9b40f..4f759376d 100644
--- a/gradio/routes.py
+++ b/gradio/routes.py
@@ -1646,6 +1646,8 @@ def mount_gradio_app(
     ssr_mode: bool | None = None,
     node_server_name: str | None = None,
     node_port: int | None = None,
+    enable_monitoring: bool | None = None,
+    pwa: bool | None = None,
 ) -> fastapi.FastAPI:
     """Mount a gradio.Blocks to an existing FastAPI application.
 
@@ -1695,6 +1697,9 @@ def mount_gradio_app(
     blocks.custom_mount_path = path
     blocks.server_port = server_port
     blocks.server_name = server_name
+    blocks.enable_monitoring = enable_monitoring
+    if pwa is not None:
+        blocks.pwa = pwa
 
     if auth is not None and auth_dependency is not None:
         raise ValueError(
@@ -1733,14 +1738,13 @@ def mount_gradio_app(
         )
     )
 
-    blocks.node_path = os.environ.get(
-        "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
-    )
-
-    blocks.node_server_name = node_server_name
-    blocks.node_port = node_port
-
     if blocks.ssr_mode:
+        blocks.node_path = os.environ.get(
+            "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
+        )
+
+        blocks.node_server_name = node_server_name
+        blocks.node_port = node_port
         blocks.node_server_name, blocks.node_process, blocks.node_port = (
             start_node_server(
                 server_name=blocks.node_server_name,
diff --git a/js/chatbot/shared/Message.svelte b/js/chatbot/shared/Message.svelte
index 67e8fb163..6ee2c046f 100644
--- a/js/chatbot/shared/Message.svelte
+++ b/js/chatbot/shared/Message.svelte
@@ -496,7 +496,7 @@
 		height: 100%;
 		object-fit: cover;
 		border-radius: 50%;
-		padding: 6px;
+		padding: var(--size-1-5);
 	}
 
 	.selectable {
diff --git a/js/chatbot/shared/Pending.svelte b/js/chatbot/shared/Pending.svelte
index 8bd8888f2..f3946d183 100644
--- a/js/chatbot/shared/Pending.svelte
+++ b/js/chatbot/shared/Pending.svelte
@@ -84,6 +84,14 @@
 		margin-right: var(--spacing-xxl);
 	}
 
+	.avatar-container:not(.thumbnail-item) :global(img) {
+		width: 100%;
+		height: 100%;
+		object-fit: cover;
+		border-radius: 50%;
+		padding: var(--size-1-5);
+	}
+
 	.message-content {
 		padding: var(--spacing-sm) var(--spacing-xl);
 		min-height: var(--size-8);
diff --git a/js/core/src/Blocks.svelte b/js/core/src/Blocks.svelte
index 446326053..26d869101 100644
--- a/js/core/src/Blocks.svelte
+++ b/js/core/src/Blocks.svelte
@@ -387,7 +387,7 @@
 				);
 			} catch (e) {
 				const fn_index = 0; // Mock value for fn_index
-				if (!app.stream_status.open) return; // when a user navigates away in multipage app.
+				if (app.closed) return; // when a user navigates away in multipage app.
 				messages = [
 					new_message("Error", String(e), fn_index, "error"),
 					...messages
@@ -719,7 +719,7 @@
 			value: LoadingStatus;
 		}[] = [];
 		Object.entries(statuses).forEach(([id, loading_status]) => {
-			if (!app.stream_status.open && loading_status.status === "error") {
+			if (app.closed && loading_status.status === "error") {
 				// when a user navigates away in multipage app.
 				return;
 			}


Test patch:
diff --git a/test/test_routes.py b/test/test_routes.py
index b4d5c66fa..dd4c51a79 100644
--- a/test/test_routes.py
+++ b/test/test_routes.py
@@ -1,6 +1,7 @@
 """Contains tests for networking.py and app.py"""
 
 import functools
+import inspect
 import json
 import os
 import pickle
@@ -1671,3 +1672,42 @@ def test_file_without_meta_key_not_moved():
             assert req.status_code == 500
     finally:
         demo.close()
+
+
+def test_mount_gradio_app_args_match_launch_args():
+    """Test that all arguments in Blocks.launch() are also valid in mount_gradio_app()."""
+    # Get the parameters from both functions
+    launch_params = inspect.signature(gr.Blocks.launch).parameters
+    mount_params = inspect.signature(routes.mount_gradio_app).parameters
+
+    # Parameters that are intentionally not included in mount_gradio_app
+    exception_list = {
+        "inline",
+        "inbrowser",
+        "prevent_thread_lock",
+        "debug",
+        "quiet",
+        "height",
+        "width",
+        "ssl_keyfile",
+        "ssl_certfile",
+        "ssl_keyfile_password",
+        "ssl_verify",
+        "share",
+        "share_server_address",
+        "share_server_protocol",
+        "state_session_capacity",
+        "_frontend",
+        "self",
+        "strict_cors",
+        "max_threads",
+    }
+
+    missing_params = []
+    for param_name in launch_params:
+        if param_name not in exception_list and param_name not in mount_params:
+            missing_params.append(param_name)
+
+    assert not missing_params, (
+        f"Parameters in launch() but missing in mount_gradio_app(): {missing_params}"
+    )