Skip to content

Commit

Permalink
fix semver breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelleyrtp committed Jan 8, 2025
1 parent 651e6ab commit a622868
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/interpreter/src/js/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[6449103750905854967, 17669692872757955279, 13069001215487072322, 7552882699631236642, 4823736819599448666, 5444526391971481782, 12156139214887111728, 5052021921702764563, 12925655762638175824, 5638004933879392817]
[6449103750905854967, 17669692872757955279, 13069001215487072322, 11420464406527728232, 3770103091118609057, 5444526391971481782, 12156139214887111728, 5052021921702764563, 12925655762638175824, 5638004933879392817]
2 changes: 1 addition & 1 deletion packages/interpreter/src/js/hydrate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ pub mod minimal_bindings {
extern "C" {
/// Register a callback that that will be called to hydrate a node at the given id with data from the server
pub fn register_rehydrate_chunk_for_streaming(
closure: &wasm_bindgen::closure::Closure<dyn FnMut(Vec<u32>, js_sys::Uint8Array)>,
);

/// Register a callback that that will be called to hydrate a node at the given id with data from the server
pub fn register_rehydrate_chunk_for_streaming_debug(
closure: &wasm_bindgen::closure::Closure<
dyn FnMut(Vec<u32>, js_sys::Uint8Array, Option<Vec<String>>, Option<Vec<String>>),
>,
Expand Down
9 changes: 7 additions & 2 deletions packages/interpreter/src/ts/hydrate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import "./hydrate_types";
import { HydrationCallback } from "./hydrate_types";

export function register_rehydrate_chunk_for_streaming(
callback: (id: number[], data: Uint8Array) => void
export function register_rehydrate_chunk_for_streaming(callback: HydrationCallback): void {
return register_rehydrate_chunk_for_streaming_debug(callback);
}

export function register_rehydrate_chunk_for_streaming_debug(
callback: HydrationCallback
): void {
window.hydration_callback = callback;
for (let i = 0; i < window.hydrate_queue.length; i++) {
Expand Down
18 changes: 10 additions & 8 deletions packages/interpreter/src/ts/hydrate_types.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
export {};
export { };

export type HydrationCallback = (
id: number[],
data: Uint8Array,
debug_types: string[] | null,
debug_locations: string[] | null
) => void;

declare global {
interface Window {
hydrate_queue: [number[], Uint8Array, string[] | null, string[] | null][];
hydration_callback:
| null
| ((
id: number[],
data: Uint8Array,
debug_types: string[] | null,
debug_locations: string[] | null
) => void);
| null
| HydrationCallback;
}
}
4 changes: 3 additions & 1 deletion packages/web/src/hydration/hydrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ impl WebsysDom {
});
};
let closure = wasm_bindgen::closure::Closure::new(closure);
dioxus_interpreter_js::minimal_bindings::register_rehydrate_chunk_for_streaming(&closure);
dioxus_interpreter_js::minimal_bindings::register_rehydrate_chunk_for_streaming_debug(
&closure,
);
closure.forget();

// Rehydrate the root scope that was rendered on the server. We will likely run into suspense boundaries.
Expand Down

0 comments on commit a622868

Please sign in to comment.