Skip to content

Commit

Permalink
Fix canister id in test app (#1857)
Browse files Browse the repository at this point in the history
The test app canister id replacement mechanism broke
(presumably quite a while ago). This fixes PR fixes it.
  • Loading branch information
frederikrothenberger authored Sep 7, 2023
1 parent ceea949 commit 90e7ce2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions demos/test-app/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ lazy_static! {
let canister_id = api::id();
let index_html = include_str!("dist/index.html");

// the string we are replacing here is inserted by webpack during the front-end build
// the string we are replacing here is inserted by vite during the front-end build
let index_html = index_html.replace(
r#"<script defer src="bundle.js"></script>"#,
&format!(r#"<script>var canisterId = '{canister_id}';</script><script defer="defer" src="bundle.js"></script>"#).to_string()
r#"<script type="module" crossorigin src="/index.js"></script>"#,
&format!(r#"<script>var canisterId = '{canister_id}';</script><script type="module" crossorigin src="/index.js"></script>"#).to_string()
);
index_html
};
Expand Down
2 changes: 1 addition & 1 deletion demos/test-app/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1>Contact the IC</h1>
<label for="canisterId" style="display: inline-block; width: 120px"
>Canister ID:
</label>
<input type="text" id="canisterId" value="kvusz-kaaaa-aaaad-aabwa-cai" />
<input type="text" id="canisterId" />
</div>
<div>
<button id="whoamiBtn">Who Am I?</button>
Expand Down

0 comments on commit 90e7ce2

Please sign in to comment.