-
Notifications
You must be signed in to change notification settings - Fork 2
Fix/oxlint #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Fix/oxlint #299
Conversation
components added
| const { id } = defineProps({ | ||
| id: { type: String, required: true }, | ||
| }) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combinaison de Promise.all et map() pour se passer de la boucle
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await Promise.all( | ||
| this.microservices.map(async (store) => { | ||
| await store.connect() | ||
| console.log("[INFRA] Microservice connected:", store.$id) | ||
| }) | ||
| }) | ||
|
|
||
| await Promise.all(connection_promises) | ||
| }), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refacto
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilisation de viewer_call pour plus de robustesse
| ) | ||
| ids.push(id) | ||
| } | ||
| const ids = await Promise.all(items.map((item) => importItem(item))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.all + .map() encore
| async function wait_for_ready(child, expected_response) { | ||
| for await (const [data] of on(child.stdout, "data")) { | ||
| if (data.toString().includes(expected_response)) { | ||
| return child | ||
| } | ||
| } | ||
| throw new Error("Process closed before signal") | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nouvelle fonction pour l'écouteur d'evenements => on atteend chaque ligne de log de manière séquentielle. Evite de stocker les états en deehors de la boucle pour savoir si on a trouvé le message attendu
app/utils/local.js
Outdated
| } | ||
| } | ||
|
|
||
| async function run_back( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_back et run_viewer :
run_scirpt est déjà async, pas besoin de new Promise
| async function wait_nuxt(nuxt_process, back_port, viewer_port) { | ||
| for await (const [data] of on(nuxt_process.stdout, "data")) { | ||
| const output = data.toString() | ||
| const portMatch = output.match( | ||
| /Accepting connections at http:\/\/localhost:(\d+)/, | ||
| ) | ||
| console.log("Nuxt:", output) | ||
| if (portMatch) { | ||
| const [, nuxt_port] = portMatch | ||
| process.env.NUXT_PORT = nuxt_port | ||
| return { geode_port: back_port, viewer_port, nuxt_port } | ||
| } | ||
| } | ||
| throw new Error("Nuxt process closed without accepting connections") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logique "noyée" à la fiun de run_browser
Responsabilise chaque méthode
Améliore juste la lissibilité, à débattre
| const newDb = new ExtendedDatabase( | ||
| currentVersion, | ||
| currentStores, | ||
| tableName, | ||
| schemaDefinition, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 classe par fichier
| const { client } = microservice | ||
|
|
||
| const promise = new Promise((resolve, reject) => { | ||
| async function performCall() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilisation async function avec try/catch/finally pour notamment garantir le stop_request() en cas d'erreur pour éviter dde laisser le store en état occupé
No description provided.