Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow server-only load functions to return more than JSON #6318

Merged
merged 25 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
error nodes are not serialized for hydration
  • Loading branch information
Rich-Harris committed Aug 29, 2022
commit b0bea0131eefbf1cc074014d53f628b3f1c26b8a
8 changes: 0 additions & 8 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1292,14 +1292,6 @@ export function create_client({ target, base, trailing_slash }) {
const branch_promises = node_ids.map(async (n, i) => {
const server_data_node = server_data_nodes[i];

if (server_data_node?.type === 'error') {
if (server_data_node.httperror) {
throw error(server_data_node.httperror.status, server_data_node.httperror.message);
}

throw server_data_node.error;
}

return load_node({
loader: nodes[n],
url,
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface Client {
node_ids: number[];
params: Record<string, string>;
routeId: string | null;
data: Array<import('types').ServerDataNode | import('types').ServerErrorNode | null>;
data: Array<import('types').ServerDataNode | null>;
errors: Record<string, any> | null;
}) => Promise<void>;
_start_router: () => void;
Expand Down