Skip to content

Commit 9edbd07

Browse files
committed
chore(serdes): name SerializationBackRef
1 parent 9e93dc0 commit 9edbd07

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/qwik/src/core/shared/serdes/serialization-context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export let isDomRef = (obj: unknown): obj is DomRef => false;
3030
* A back reference to a previously serialized object. Before deserialization, all backrefs are
3131
* swapped with their original locations.
3232
*/
33-
export class BackRef {
33+
export class SerializationBackRef {
3434
constructor(
3535
/** The path from root to the original object */
3636
public $path$: string
@@ -156,7 +156,7 @@ export const createSerializationContext = (
156156
if (index === undefined) {
157157
index = roots.length;
158158
}
159-
roots[index] = new BackRef(path);
159+
roots[index] = new SerializationBackRef(path);
160160
ref.$parent$ = null;
161161
ref.$index$ = index;
162162
};

packages/qwik/src/core/shared/serdes/serialize.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ import { isPromise, maybeThen } from '../utils/promises';
3838
import { fastSkipSerialize, SerializerSymbol } from './verify';
3939
import { Constants, TypeIds } from './constants';
4040
import { qrlToString } from './qrl-to-string';
41-
import { BackRef, type SeenRef, type SerializationContext } from './serialization-context';
41+
import {
42+
SerializationBackRef,
43+
type SeenRef,
44+
type SerializationContext,
45+
} from './serialization-context';
4246

4347
/**
4448
* Format:
@@ -169,7 +173,7 @@ export async function serialize(serializationContext: SerializationContext): Pro
169173
}
170174

171175
// Now we know it's a root and we should output a RootRef
172-
const rootIdx = value instanceof BackRef ? value.$path$ : seen.$index$;
176+
const rootIdx = value instanceof SerializationBackRef ? value.$path$ : seen.$index$;
173177

174178
// But make sure we do output ourselves
175179
if (!parent && rootIdx === index) {
@@ -280,7 +284,7 @@ export async function serialize(serializationContext: SerializationContext): Pro
280284
output(TypeIds.Constant, Constants.EMPTY_OBJ);
281285
} else if (value === null) {
282286
output(TypeIds.Constant, Constants.Null);
283-
} else if (value instanceof BackRef) {
287+
} else if (value instanceof SerializationBackRef) {
284288
output(TypeIds.RootRef, value.$path$);
285289
} else {
286290
const newSeenRef = getSeenRefOrOutput(value, index);

0 commit comments

Comments
 (0)