File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/cubejs-schema-compiler/src/compiler Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -217,9 +217,11 @@ export class DataSchemaCompiler {
217217 this . pythonContext = await this . loadPythonContext ( files , 'globals.py' ) ;
218218 this . yamlCompiler . initFromPythonContext ( this . pythonContext ) ;
219219
220- const toCompile = this . filesToCompile ?. length
221- ? files . filter ( f => this . filesToCompile . includes ( f . fileName ) )
222- : files ;
220+ // As we mutate files data, we need a copy, not a refs.
221+ // FileContent is a plain object with primitives, so it's enough for a shallow copy.
222+ let toCompile = this . filesToCompile ?. length
223+ ? files . filter ( f => this . filesToCompile . includes ( f . fileName ) ) . map ( f => ( { ...f } ) )
224+ : files . map ( f => ( { ...f } ) ) ;
223225
224226 const jinjaTemplatedFiles = toCompile . filter ( ( file ) => file . fileName . endsWith ( '.jinja' ) ||
225227 ( file . fileName . endsWith ( '.yml' ) || file . fileName . endsWith ( '.yaml' ) ) && file . content . match ( JINJA_SYNTAX ) ) ;
@@ -436,6 +438,7 @@ export class DataSchemaCompiler {
436438 compiledFiles = { } ;
437439 asyncModules = [ ] ;
438440 transpiledFiles = [ ] ;
441+ toCompile = [ ] ;
439442
440443 if ( transpilationNative ) {
441444 // Clean up cache
You can’t perform that action at this time.
0 commit comments