Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Sep 8, 2023
1 parent 8a96629 commit c74d174
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/CanisterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export function CanisterModal({ isOpen, close, deploySetter }) {
await deploySetter.setInitTypes(init);
await deploySetter.setCandidCode(candid);
await deploySetter.setShowDeployModal(true);
await dispatch({
type: "setOrigin",
payload: { origin: "playground:wasm", tags: [] },
});
}
async function addCanister() {
if (error || !canisterName || !canisterId || !candid) {
Expand Down
10 changes: 9 additions & 1 deletion src/components/ImportGithub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import styled from "styled-components";
import { useState, useContext } from "react";
import { Button } from "./shared/Button";
import { PackageInfo } from "../workers/file";
import { WorkerContext } from "../contexts/WorkplaceState";
import {
WorkerContext,
WorkplaceDispatchContext,
} from "../contexts/WorkplaceState";
import { Field } from "./shared/Field";

const Container = styled.div`
Expand Down Expand Up @@ -33,12 +36,17 @@ export function ImportGitHub({ importCode, close, isPackageModal = false }) {
const [error, setError] = useState("");
const [name, setName] = useState("");
const worker = useContext(WorkerContext);
const dispatch = useContext(WorkplaceDispatchContext);
async function fetchCode() {
const files = await worker.fetchGithub({ repo, branch, dir });
if (files) {
setError("");
importCode(files);
close();
await dispatch({
type: "setOrigin",
payload: { origin: "playground:git", tags: [`git:${repo}`] },
});
} else {
setError(`Cannot find repo or the directory contains no ".mo" files.`);
}
Expand Down

0 comments on commit c74d174

Please sign in to comment.