mchades commented on code in PR #12900:
URL: https://github.com/apache/gravitino/pull/12900#discussion_r4265922681


##########
web-v2/web/src/lib/api/semanticModels/index.js:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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 { defHttp } from '@/lib/utils/axios'
+
+const Apis = {
+  GET: ({ metalake, catalog, schema }) =>
+    
`/api/metalakes/${encodeURIComponent(metalake)}/catalogs/${encodeURIComponent(
+      catalog
+    )}/schemas/${encodeURIComponent(schema)}/semantic-models`,
+  GET_DETAIL: ({ metalake, catalog, schema, semanticModel }) =>
+    
`/api/metalakes/${encodeURIComponent(metalake)}/catalogs/${encodeURIComponent(
+      catalog
+    
)}/schemas/${encodeURIComponent(schema)}/semantic-models/${encodeURIComponent(semanticModel)}`
+}
+
+export const getSemanticModelsApi = (params, options) => {
+  return defHttp.get(
+    {
+      url: `${Apis.GET(params)}`
+    },
+
+    // The schema tab and tree load this list independently and must not 
cancel each other.
+    { ...options, ignoreCancelToken: true }

Review Comment:
   [P2] Prevent older list responses from overwriting a refresh
   
   With duplicate cancellation disabled for every list call, an earlier 
`fetchSemanticModels` can finish after the refresh issued by 
import/create/delete. Neither its `setIntoTreeNodes` dispatch nor the fulfilled 
reducer checks whether the response is stale. On this head I held the initial 
list response, imported `review_refresh_246108`, and let the post-import 
refresh complete: the model appeared in both views. Releasing the initial 
response then removed it from both the tree and tab although the REST list 
still contained it. Keep the tree and schema requests independent, but ignore 
superseded list results (including the tree update) so a slow pre-mutation 
response cannot undo the successful refresh.



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