Skip to content

Commit 6c4bd10

Browse files
committed
remove unused qerrors
1 parent bd4eb50 commit 6c4bd10

File tree

3 files changed

+71
-97
lines changed

3 files changed

+71
-97
lines changed

.changeset/rare-candies-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik.dev/core': patch
3+
---
4+
5+
fix: skip serialize functions wrapped with the `noSerialize`

packages/qwik/src/core/shared/error/error.ts

Lines changed: 62 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,37 @@ export const codeToText = (code: number, ...parts: any[]): string => {
99
'Scheduler not found', // 1
1010
'track() received object, without prop to track', // 2
1111
'Only primitive and object literals can be serialized. {{0}}', // 3
12-
'', // 4 unused
13-
'You can render over a existing q:container. Skipping render().', // 5
14-
'', // 6 unused
15-
'', // 7 unused
16-
'', // 8 unused
17-
'', // 9 unused
18-
'QRL is not a function', // 10
19-
'Dynamic import not found', // 11
20-
'Unknown type argument', // 12
21-
`Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`, // 13
22-
"Invoking 'use*()' method outside of invocation context.", // 14
23-
'', // 15 unused
24-
'', // 16 unused
25-
'', // 17 unused
26-
'', // 18 unused
27-
'', // 19 unused
28-
`Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.\nSee https://qwik.dev/docs/components/tasks/#use-method-rules`, // 20
29-
'', // 21 unused
30-
'', // 22 unused
31-
'', // 23 unused
32-
'', // 24 unused
33-
'', // 25 unused
34-
'', // 26 unused
35-
'', // 27 unused
36-
'The provided Context reference "{{0}}" is not a valid context created by createContextId()', // 28
37-
'SsrError(tag): {{0}}', // 29
38-
'QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.', // 30
39-
'QRLs can not be dynamically resolved, because it does not have a chunk path', // 31
40-
'{{0}}\nThe JSX ref attribute must be a Signal', // 32
41-
'Serialization Error: Deserialization of data type {{0}} is not implemented', // 33
42-
'Serialization Error: Expected vnode for ref prop, but got {{0}}', // 34
43-
'Serialization Error: Cannot allocate data type {{0}}', // 35
44-
'Serialization Error: Missing root id for {{0}}', // 36
45-
'Serialization Error: Serialization of data type {{0}} is not implemented', // 37
46-
'Serialization Error: Unvisited {{0}}', // 38
47-
'Serialization Error: Missing QRL chunk for {{0}}', // 39
48-
'{{0}}\nThe value of the textarea must be a string found {{1}}', // 40
49-
'Unable to find q:container', // 41
50-
"Element must have 'q:container' attribute.", // 42
51-
'Unknown vnode type {{0}}.', // 43
52-
'Materialize error: missing element: {{0}} {{1}} {{2}}', // 44
53-
'Cannot coerce a Signal, use `.value` instead', // 45
54-
'useComputed$ QRL {{0}} {{1}} cannot return a Promise', // 46
55-
'ComputedSignal is read-only', // 47
56-
'WrappedSignal is read-only', // 48
57-
'Attribute value is unsafe for SSR', // 49
58-
'SerializerSymbol function returned rejected promise', // 50
59-
'Serialization Error: Cannot serialize function: {{0}}', // 51
12+
'You can render over a existing q:container. Skipping render().', // 4
13+
'QRL is not a function', // 5
14+
'Dynamic import not found', // 6
15+
'Unknown type argument', // 7
16+
`Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`, // 8
17+
"Invoking 'use*()' method outside of invocation context.", // 9
18+
`Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.\nSee https://qwik.dev/docs/components/tasks/#use-method-rules`, // 10
19+
'The provided Context reference "{{0}}" is not a valid context created by createContextId()', // 11
20+
'SsrError(tag): {{0}}', // 12
21+
'QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.', // 13
22+
'QRLs can not be dynamically resolved, because it does not have a chunk path', // 14
23+
'{{0}}\nThe JSX ref attribute must be a Signal', // 15
24+
'Serialization Error: Deserialization of data type {{0}} is not implemented', // 16
25+
'Serialization Error: Expected vnode for ref prop, but got {{0}}', // 17
26+
'Serialization Error: Cannot allocate data type {{0}}', // 18
27+
'Serialization Error: Missing root id for {{0}}', // 19
28+
'Serialization Error: Serialization of data type {{0}} is not implemented', // 20
29+
'Serialization Error: Unvisited {{0}}', // 21
30+
'Serialization Error: Missing QRL chunk for {{0}}', // 22
31+
'{{0}}\nThe value of the textarea must be a string found {{1}}', // 23
32+
'Unable to find q:container', // 24
33+
"Element must have 'q:container' attribute.", // 25
34+
'Unknown vnode type {{0}}.', // 26
35+
'Materialize error: missing element: {{0}} {{1}} {{2}}', // 27
36+
'Cannot coerce a Signal, use `.value` instead', // 28
37+
'useComputed$ QRL {{0}} {{1}} cannot return a Promise', // 29
38+
'ComputedSignal is read-only', // 30
39+
'WrappedSignal is read-only', // 31
40+
'Attribute value is unsafe for SSR', // 32
41+
'SerializerSymbol function returned rejected promise', // 33
42+
'Serialization Error: Cannot serialize function: {{0}}', // 34
6043
];
6144
let text = MAP[code] ?? '';
6245
if (parts.length) {
@@ -80,54 +63,37 @@ export const enum QError {
8063
schedulerNotFound = 1,
8164
trackObjectWithoutProp = 2,
8265
verifySerializable = 3,
83-
UNUSED_4 = 4,
84-
cannotRenderOverExistingContainer = 5,
85-
UNUSED_6 = 6,
86-
UNUSED_7 = 7,
87-
UNUSED_8 = 8,
88-
UNUSED_9 = 9,
89-
qrlIsNotFunction = 10,
90-
dynamicImportFailed = 11,
91-
unknownTypeArgument = 12,
92-
notFoundContext = 13,
93-
useMethodOutsideContext = 14,
94-
UNUSED_15 = 15,
95-
UNUSED_16 = 16,
96-
UNUSED_17 = 17,
97-
UNUSED_18 = 18,
98-
UNUSED_19 = 19,
99-
useInvokeContext = 20,
100-
UNUSED_21 = 21,
101-
UNUSED_22 = 22,
102-
UNUSED_23 = 23,
103-
UNUSED_24 = 24,
104-
UNUSED_25 = 25,
105-
UNUSED_26 = 26,
106-
UNUSED_27 = 27,
107-
invalidContext = 28,
108-
tagError = 29,
109-
qrlMissingContainer = 30,
110-
qrlMissingChunk = 31,
111-
invalidRefValue = 32,
112-
serializeErrorNotImplemented = 33,
113-
serializeErrorExpectedVNode = 34,
114-
serializeErrorCannotAllocate = 35,
115-
serializeErrorMissingRootId = 36,
116-
serializeErrorUnknownType = 37,
117-
serializeErrorUnvisited = 38,
118-
serializeErrorMissingChunk = 39,
119-
wrongTextareaValue = 40,
120-
containerNotFound = 41,
121-
elementWithoutContainer = 42,
122-
invalidVNodeType = 43,
123-
materializeVNodeDataError = 44,
124-
cannotCoerceSignal = 45,
125-
computedNotSync = 46,
126-
computedReadOnly = 47,
127-
wrappedReadOnly = 48,
128-
unsafeAttr = 49,
129-
serializerSymbolRejectedPromise = 50,
130-
serializeErrorCannotSerializeFunction = 51,
66+
cannotRenderOverExistingContainer = 4,
67+
qrlIsNotFunction = 5,
68+
dynamicImportFailed = 6,
69+
unknownTypeArgument = 7,
70+
notFoundContext = 8,
71+
useMethodOutsideContext = 9,
72+
useInvokeContext = 10,
73+
invalidContext = 11,
74+
tagError = 12,
75+
qrlMissingContainer = 13,
76+
qrlMissingChunk = 14,
77+
invalidRefValue = 15,
78+
serializeErrorNotImplemented = 16,
79+
serializeErrorExpectedVNode = 17,
80+
serializeErrorCannotAllocate = 18,
81+
serializeErrorMissingRootId = 19,
82+
serializeErrorUnknownType = 20,
83+
serializeErrorUnvisited = 21,
84+
serializeErrorMissingChunk = 22,
85+
wrongTextareaValue = 23,
86+
containerNotFound = 24,
87+
elementWithoutContainer = 25,
88+
invalidVNodeType = 26,
89+
materializeVNodeDataError = 27,
90+
cannotCoerceSignal = 28,
91+
computedNotSync = 29,
92+
computedReadOnly = 30,
93+
wrappedReadOnly = 31,
94+
unsafeAttr = 32,
95+
serializerSymbolRejectedPromise = 33,
96+
serializeErrorCannotSerializeFunction = 34,
13197
}
13298

13399
export const qError = (code: number, errorMessageArgs: any[] = []): Error => {

packages/qwik/src/core/shared/shared-serialization.unit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { isQrl } from './qrl/qrl-utils';
2626
import { NoSerializeSymbol, SerializerSymbol } from './utils/serialize-utils';
2727
import { SubscriptionData } from '../reactive-primitives/subscription-data';
2828
import { StoreFlags } from '../reactive-primitives/types';
29+
import { QError } from './error/error';
2930

3031
const DEBUG = false;
3132

@@ -1059,7 +1060,9 @@ describe('shared-serialization', () => {
10591060
throw 'oh no';
10601061
}
10611062
}
1062-
await expect(serialize(new Foo())).rejects.toThrow('Q50');
1063+
await expect(serialize(new Foo())).rejects.toThrow(
1064+
'Q' + QError.serializerSymbolRejectedPromise
1065+
);
10631066
expect(consoleSpy).toHaveBeenCalledWith('oh no');
10641067
consoleSpy.mockRestore();
10651068
});

0 commit comments

Comments
 (0)