Skip to content

Commit 6a1539c

Browse files
committed
Fixed reducer callback bug, fixed table name code gen issue
1 parent 149e7b7 commit 6a1539c

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

crates/bindings-typescript/src/sdk/db_connection_impl.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,10 @@ export class DbConnectionImpl<RemoteModule extends UntypedRemoteModule>
761761
eventContext
762762
);
763763

764-
const argsArray: any[] = [];
765-
reducer.paramsType.elements.forEach(element => {
766-
argsArray.push(reducerArgs[element.name!]);
767-
});
768764
this.#reducerEmitter.emit(
769765
reducerInfo.reducerName,
770766
reducerEventContext,
771-
...argsArray
767+
reducerArgs
772768
);
773769
for (const callback of callbacks) {
774770
callback.cb();

crates/codegen/src/typescript.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl Lang for TypeScript {
218218
out.indent(1);
219219
for table in iter_tables(module) {
220220
let type_ref = table.product_type_ref;
221-
let row_type_name = type_ref_name(module, type_ref);
221+
let table_name_pascalcase = table.name.deref().to_case(Case::Pascal);
222222
writeln!(out, "__table({{");
223223
out.indent(1);
224224
write_table_opts(
@@ -230,16 +230,16 @@ impl Lang for TypeScript {
230230
iter_constraints(table),
231231
);
232232
out.dedent(1);
233-
writeln!(out, "}}, {}Row),", row_type_name);
233+
writeln!(out, "}}, {}Row),", table_name_pascalcase);
234234
}
235235
for view in iter_views(module) {
236236
let type_ref = view.product_type_ref;
237-
let row_type_name = type_ref_name(module, type_ref);
237+
let view_name_pascalcase = view.name.deref().to_case(Case::Pascal);
238238
writeln!(out, "__table({{");
239239
out.indent(1);
240240
write_table_opts(module, out, type_ref, &view.name, iter::empty(), iter::empty());
241241
out.dedent(1);
242-
writeln!(out, "}}, {}Row),", row_type_name);
242+
writeln!(out, "}}, {}Row),", view_name_pascalcase);
243243
}
244244
out.dedent(1);
245245
writeln!(out, ");");

0 commit comments

Comments
 (0)