Skip to content

Commit 83d92fd

Browse files
Fix statustracker for generating outputs (#12337)
* Fix number status * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent 6a54d33 commit 83d92fd

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

.changeset/petite-books-hunt.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gradio/core": minor
3+
"gradio": minor
4+
---
5+
6+
feat:Fix statustracker for generating outputs

.config/playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const base = defineConfig({
1818
timeout: 30_000,
1919
testMatch: /.*\.spec\.ts/,
2020
testDir: "..",
21-
workers: undefined,
21+
workers: process.env.CI ? 6 : undefined,
2222
retries: 3
2323
});
2424

js/core/src/dependency.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,14 @@ export class DependencyManager {
431431
break submit_loop;
432432
} else if (result.stage === "generating") {
433433
this.dispatch_state_change_events(result);
434+
// @ts-ignore
435+
this.loading_stati.update({
436+
...status,
437+
status: status.stage,
438+
fn_index: dep.id,
439+
stream_state
440+
});
441+
this.update_loading_stati_state();
434442
} else if (result.stage === "error") {
435443
if (Array.isArray(result?.message)) {
436444
result.message.forEach((m: ValidationError, i) => {

js/core/src/init.svelte.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@ export class AppTree {
149149
postprocess(tree: ProcessedComponentMeta) {
150150
this.root = this.traverse(tree, [
151151
(node) => handle_visibility(node, this.#config.root),
152-
(node) => untrack_children_of_invisible_parents(
153-
node,
154-
this.#config.root,
155-
this.components_to_register
156-
),
152+
(node) =>
153+
untrack_children_of_invisible_parents(
154+
node,
155+
this.#config.root,
156+
this.components_to_register
157+
),
157158
(node) =>
158159
handle_empty_forms(
159160
node,
@@ -331,7 +332,7 @@ export class AppTree {
331332
this.root = this.traverse(this.root!, [
332333
//@ts-ignore
333334
(n) => set_visibility_for_updated_node(n, id, new_state.visible),
334-
(n) => handle_visibility(n, this.#config.root),
335+
(n) => handle_visibility(n, this.#config.root)
335336
]);
336337
already_updated_visibility = true;
337338
}
@@ -500,23 +501,24 @@ function set_visibility_for_updated_node(
500501
return node;
501502
}
502503

503-
function _untrack(node: ProcessedComponentMeta, components_to_register: Set<number>): void {
504+
function _untrack(
505+
node: ProcessedComponentMeta,
506+
components_to_register: Set<number>
507+
): void {
504508
components_to_register.delete(node.id);
505509
if (node.children) {
506510
node.children.forEach((child) => _untrack(child, components_to_register));
507511
}
508512
return;
509513
}
510514

511-
512515
function untrack_children_of_invisible_parents(
513516
node: ProcessedComponentMeta,
514517
root: string,
515518
components_to_register: Set<number>
516519
): ProcessedComponentMeta {
517520
// Check if the node is visible
518521
if (node.props.shared_props.visible !== true) {
519-
console.log("Untracking children of invisible parent:", node.id, node.children);
520522
_untrack(node, components_to_register);
521523
}
522524
return node;

0 commit comments

Comments
 (0)