Skip to content

Commit f394fa6

Browse files
committed
fix(core): Do not create an empty-on serializer if emptyOn wasn't given
1 parent 5d90b63 commit f394fa6

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

projects/ngqp/core/src/lib/model.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ export class QueryParam<T> {
174174
private changeFunctions: OnChangeFunction<T>[] = [];
175175

176176
constructor(opts: QueryParamOpts<T>) {
177-
const { param, serialize, deserialize, debounceTime, compareWith, combineWith } = opts;
178-
const { emptyOn = null } = opts;
177+
const { param, serialize, deserialize, debounceTime, compareWith, emptyOn, combineWith } = opts;
179178
const multi = opts.multi === true;
180179

181180
if (isMissing(param)) {
@@ -204,11 +203,11 @@ export class QueryParam<T> {
204203

205204
this.param = param;
206205
this.serialize = wrapTryCatch(
207-
createEmptyOnSerializer(serialize, emptyOn, compareWith),
206+
emptyOn === undefined ? serialize : createEmptyOnSerializer(serialize, emptyOn, compareWith),
208207
`Error while serializing value for ${param}`
209208
);
210209
this.deserialize = wrapTryCatch(
211-
createEmptyOnDeserializer(deserialize, emptyOn),
210+
emptyOn === undefined ? deserialize : createEmptyOnDeserializer(deserialize, emptyOn),
212211
`Error while deserializing value for ${param}`
213212
);
214213
this.multi = multi;

0 commit comments

Comments
 (0)