Skip to content

Commit

Permalink
fix(#246): construct url dynamically
Browse files Browse the repository at this point in the history
Seems to not throw lifecycle errors anymore
  • Loading branch information
marisademeglio committed Oct 11, 2024
1 parent 4c58d82 commit 971a58f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/renderer/utils/temp-datatype.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { datatypeXmlToJson } from 'shared/parser/pipelineXmlConverter'

const { App } = window
// import { baseurl } from 'shared/types'
// import { useWindowStore } from 'renderer/store'
import { baseurl } from 'shared/types'
import { useWindowStore } from 'renderer/store'

async function fetchTemporaryDatatype(id) {
try {
// let href = `${baseurl(
// useWindowStore().pipeline.webservice
// )}/datatypes/${id}`
// TODO construct URL dynamically; the above was causing react to throw lifecycle error
let href = `http://localhost:49152/ws/datatypes/${id}`
let href = `${baseurl(
useWindowStore().pipeline.webservice
)}/datatypes/${id}`
// can't use IPC fetch due to async problems matching event send and receive
// when multiple controls could be sending the same type of event
// however this browser-based fetch is at risk of CORS issues depending on how the pipeline engine
Expand All @@ -19,7 +16,6 @@ async function fetchTemporaryDatatype(id) {
// datatypes aren't at the global /datatypes endpoint
let data = await fetch(href)
let txt = await data.text()
console.log(`data for ${id}: \n`, txt)
let datatypeAsJson = datatypeXmlToJson(href, id, txt)
return datatypeAsJson ?? null
} catch (err) {
Expand Down

0 comments on commit 971a58f

Please sign in to comment.