carloea2 commented on code in PR #5043:
URL: https://github.com/apache/texera/pull/5043#discussion_r3263706008


##########
frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.ts:
##########
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Injectable } from "@angular/core";
+import { isEqual } from "lodash-es";
+import { ReplaySubject } from "rxjs";
+import { WorkflowActionService } from 
"../workflow-graph/model/workflow-action.service";
+import { UiUdfParameter, UiUdfParametersParserService } from 
"./ui-udf-parameters-parser.service";
+import { isDefined } from "../../../common/util/predicate";
+import {
+  DUAL_INPUT_PORTS_PYTHON_UDF_V2_OP_TYPE,
+  PYTHON_UDF_SOURCE_V2_OP_TYPE,
+  PYTHON_UDF_V2_OP_TYPE,
+} from "../workflow-graph/model/workflow-graph";
+import { YType } from "../../types/shared-editing.interface";
+import type { Text as YText } from "yjs";
+
+@Injectable({ providedIn: "root" })
+export class UiUdfParametersSyncService {
+  private readonly uiParametersChangedSubject = new ReplaySubject<{ 
operatorId: string; parameters: UiUdfParameter[] }>(
+    1
+  );
+
+  readonly uiParametersChanged$ = 
this.uiParametersChangedSubject.asObservable();
+
+  constructor(
+    private workflowActionService: WorkflowActionService,
+    private uiUdfParametersParserService: UiUdfParametersParserService
+  ) {}
+
+  /**
+   * Attach directly to YText and sync whenever it changes
+   */
+  attachToYCode(operatorId: string, yCode: YText): () => void {

Review Comment:
   I am not sure whether this can be done as you prefer, I remember I removed 
debounce from the original PR because it caused some troubles with the 
stability of shared editing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to