lxbme commented on code in PR #3437:
URL: https://github.com/apache/apisix-dashboard/pull/3437#discussion_r3635509083


##########
src/components/form-slice/FormPartStreamRoute/util.ts:
##########
@@ -15,28 +15,33 @@
  * limitations under the License.
  */
 import { produce } from 'immer';
-import { pipe } from 'rambdax';
 
 import { produceRmEmptyUpstreamFields } from 
'@/components/form-slice/FormPartUpstream/util';
 import { produceRmUpstreamWhenHas } from '@/utils/form-producer';
+import { pipeProduce } from '@/utils/producer';
 
 import type { StreamRoutePostType } from './schema';
 
-export const produceStreamRoute = (val: StreamRoutePostType) =>
-  pipe(
-    produceRmEmptyUpstreamFields,
-    (produceRmUpstreamWhenHas('service_id', 'upstream_id') as unknown as (
-      d: StreamRoutePostType
-    ) => StreamRoutePostType),
-    produce((draft: StreamRoutePostType) => {
-      // Stream Routes do not support name and status
-      const d = draft as StreamRoutePostType & { name?: string; status?: 
number };
-      delete d.name;
-      delete d.status;
+/**
+ * Shared by BOTH the create and edit paths — stream routes used to be the
+ * only resource whose two paths ran different cleaning pipelines (create
+ * skipped pipeProduce entirely; edit borrowed the HTTP-route producer).
+ * pipeProduce supplies the __-flag removal, empty-value cleaning and
+ * empty-plugin restore every other resource gets (#3417).
+ */
+export const produceStreamRoute = pipeProduce(

Review Comment:
   Rebased this branch onto #3438, so `pipeProduce` here already carries the 
nested-empty / inline-`discovery_args` preservation. Until #3438 merges, this 
PR's diff shows those commits on top; once it lands I'll rebase onto master so 
the diff narrows to just the stream-route changes.
   



-- 
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