This commit is contained in:
Rich Harris
2019-02-01 22:37:39 -05:00
parent 548de702ac
commit 0168d8b70c
2 changed files with 3 additions and 12 deletions

View File

@@ -9,7 +9,6 @@ import {
Redirect,
ComponentLoader,
ComponentConstructor,
RootProps,
Page,
PageData
} from './types';
@@ -25,6 +24,7 @@ let segments: string[] = [];
let current_token: {};
let root_preload: Promise<any>;
let root_data: any;
let current_branch = [];
export let prefetching: {
href: string;
@@ -189,12 +189,10 @@ async function render(results: any[], props: any, page: PageData, scroll: Scroll
if (scroll) scrollTo(scroll.x, scroll.y);
}
previous_thingummy = results;
current_branch = results;
ready = true;
}
let previous_thingummy = [];
export function prepare_page(target: Target): Promise<{
redirect?: Redirect;
data?: any;
@@ -245,7 +243,7 @@ export function prepare_page(target: Target): Promise<{
return Promise.all(page.parts.map((part, i) => {
const segment = new_segments[i];
if (i < changed_from || !part) return previous_thingummy[i];
if (i < changed_from || !part) return current_branch[i];
if (!part) return null;
return load_component(components[part.i]).then(({ default: Component, preload }) => {

View File

@@ -8,13 +8,6 @@ type Child = {
component?: Component;
};
export type RootProps = {
path: string;
params: Record<string, string>;
query: Record<string, string>;
child: Child;
};
export interface ComponentConstructor {
new (options: { target: Node, props: any, store: Store, hydrate: boolean }): Component;
preload: (props: { params: Params, query: Query }) => Promise<any>;