File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
packages/hypergraph/src/cli/services Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @graphprotocol/hypergraph " : patch
3+ ---
4+
5+ fixes loading the initial schema in typesync
6+
Original file line number Diff line number Diff line change @@ -185,13 +185,18 @@ export class TypesyncSchemaStreamBuilder extends Effect.Service<TypesyncSchemaSt
185185 yield * kv . set ( MAPPING_FILE_PATH_STORAGE_KEY , mappingFilePath . value ) ;
186186 }
187187
188- return currentSchemaStream ( schemaFilePath , mappingFilePath ) . pipe (
189- Stream . concat ( watchSchemaStream ( schemaFilePath , mappingFilePath ) ) ,
190- Stream . map ( ( stream ) => {
191- const jsonData = JSON . stringify ( stream ) ;
192- const sseData = `data: ${ jsonData } \n\n` ;
193- return encoder . encode ( sseData ) ;
194- } ) ,
188+ return Stream . concat (
189+ // This is a workaround because the browser doesn't send a message until the second message is sent.
190+ // We are sending an empty message, because then the actual first message will be the real second message and the browsers receives it.
191+ Stream . succeed ( encoder . encode ( 'data: {"types":[]}\n\n' ) ) ,
192+ currentSchemaStream ( schemaFilePath , mappingFilePath ) . pipe (
193+ Stream . concat ( watchSchemaStream ( schemaFilePath , mappingFilePath ) ) ,
194+ Stream . map ( ( stream ) => {
195+ const jsonData = JSON . stringify ( stream ) ;
196+ const sseData = `data: ${ jsonData } \n\n` ;
197+ return encoder . encode ( sseData ) ;
198+ } ) ,
199+ ) ,
195200 ) ;
196201 } ) ;
197202
You can’t perform that action at this time.
0 commit comments