Skip to content

Commit 971a58f

Browse files
fix(#246): construct url dynamically
Seems to not throw lifecycle errors anymore
1 parent 4c58d82 commit 971a58f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/renderer/utils/temp-datatype.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { datatypeXmlToJson } from 'shared/parser/pipelineXmlConverter'
22

3-
const { App } = window
4-
// import { baseurl } from 'shared/types'
5-
// import { useWindowStore } from 'renderer/store'
3+
import { baseurl } from 'shared/types'
4+
import { useWindowStore } from 'renderer/store'
65

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

0 commit comments

Comments
 (0)