Conversation
components added
| const { id } = defineProps({ | ||
| id: { type: String, required: true }, | ||
| }) | ||
|
|
There was a problem hiding this comment.
Simplification des expressions booléennes, ternaires non utiles
|
|
||
| await Promise.all( | ||
| removed.map((item) => dataStyleStore.setVisibility(item.id, false)), | ||
| ) |
There was a problem hiding this comment.
Promise.all pour s'assurer que toutesles mises à jour de visibilité sont terminées avant de faire le rendu
| const internal_files = ref(props.files) | ||
| const auto_upload = ref(props.auto_upload) | ||
| const internal_files = ref(files) | ||
| const internal_auto_upload = ref(auto_upload) |
There was a problem hiding this comment.
renommage de la ref interne pour éviter la confusion avec la prop
| } | ||
| const promise_array = internal_files.value.map((file) => | ||
| upload_file({ route: schema.$id, file }), | ||
| ) |
There was a problem hiding this comment.
Supprime l'enrobagee des promesses redondantes puisque upload_file en retourne déjà une.
.map() et Promise.all rend le traitement des fichiers asynchrone et élimine la gestion manuelle des réussites/échecs dans une boucle
| await Promise.all( | ||
| stores.map(async (store) => { | ||
| if (!store.exportStores) return | ||
| const storeId = store.$id | ||
| try { | ||
| snapshot[storeId] = await store.exportStores(params) | ||
| exportCount += 1 | ||
| } catch (error) { | ||
| console.error(`[AppStore] Error exporting store "${storeId}":`, error) | ||
| } | ||
| }), | ||
| ) |
There was a problem hiding this comment.
Combinaison de Promise.all et map() pour se passer de la boucle
| await Promise.all( | ||
| stores.map(async (store) => { | ||
| if (!store.importStores) return | ||
| const storeId = store.$id | ||
| if (!snapshot[storeId]) { | ||
| notFoundStores.push(storeId) | ||
| return | ||
| } | ||
| try { | ||
| await store.importStores(snapshot[storeId]) | ||
| importedCount += 1 | ||
| } catch (error) { | ||
| console.error(`[AppStore] Error importing store "${storeId}":`, error) | ||
| } | ||
| }), | ||
| ) |
| const component = await database.model_components | ||
| .where({ id, geode_id }) | ||
| .first() | ||
| return component?.type |
There was a problem hiding this comment.
Suppression des async/await pour utiliser .first pour utiliser https://dexie.org/docs/Collection/Collection.first() qui est plus efficace
| return meshStyleStore.setMeshVisibility(id, visibility) | ||
| } | ||
| if (viewer_type === "model") { | ||
| return modelStyleStore.setModelVisibility(id, visibility) |
There was a problem hiding this comment.
Suppression de Promise.all sur des appels de fonctions uniques
app/stores/hybrid_viewer.js
Outdated
| async function initHybridViewer() { | ||
| if (status.value !== Status.NOT_CREATED) return | ||
| status.value = Status.CREATING | ||
| // oxlint-disable-next-line import/no-named-as-default-member |
There was a problem hiding this comment.
Flag oxlint pour les imports VTK non assignés. A vérifier si nécessaire parce que le chemin dans vtkjs n'est pas le même.
Quand je mets le bon chemin, j'ai des erreurs sur Vease.
app/stores/hybrid_viewer.js
Outdated
| const item = dataStore.getItem(id) | ||
| const value = await item.fetch() | ||
| console.log("hybridViewerStore.addItem", { value }) | ||
| // oxlint-disable-next-line import/no-named-as-default-member |
| remoteRender() | ||
| for (const key in params.camera_options) { | ||
| camera_options[key] = params.camera_options[key] | ||
| if (Object.hasOwn(params.camera_options, key)) { |
There was a problem hiding this comment.
| await Promise.all( | ||
| this.microservices.map(async (store) => { | ||
| await store.connect() | ||
| console.log("[INFRA] Microservice connected:", store.$id) | ||
| }) | ||
| }) | ||
|
|
||
| await Promise.all(connection_promises) | ||
| }), | ||
| ) |
app/stores/viewer.js
Outdated
| // Connect | ||
| const { connectImageStream } = | ||
| await import("@kitware/vtk.js/Rendering/Misc/RemoteView") | ||
| try { | ||
| const validClient = await clientToConnect.connect(config) | ||
| connectImageStream(validClient.getConnection().getSession()) | ||
| this.client = validClient | ||
| clientToConnect.endBusy() | ||
| await viewer_call( | ||
| this, | ||
| { | ||
| schema: schemas.opengeodeweb_viewer.viewer.reset_visualization, | ||
| }, | ||
| { timeout: undefined }, |
There was a problem hiding this comment.
Utilisation de viewer_call pour plus de robustesse
No description provided.