Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Oct 22, 2021
1 parent 9dd0325 commit 2d07709
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
41 changes: 16 additions & 25 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,22 @@ export function App() {

const deployWorkplace = (info: CanisterInfo) => {
setForceUpdate();
workplaceDispatch(
{
type: "deployWorkplace",
payload: {
canister: info,
},
workplaceDispatch({
type: "deployWorkplace",
payload: {
canister: info,
},
worker
);
});
};

const importCode = useCallback(
(files: Record<string, string>) => {
workplaceDispatch(
{
type: "loadProject",
payload: {
files,
},
workplaceDispatch({
type: "loadProject",
payload: {
files,
},
worker
);
});
},
[workplaceDispatch]
);
Expand All @@ -215,16 +209,13 @@ export function App() {
};
(async () => {
await worker.fetchPackage(baseInfo);
await workplaceDispatch(
{
type: "loadPackage",
payload: {
name: "base",
package: baseInfo,
},
await workplaceDispatch({
type: "loadPackage",
payload: {
name: "base",
package: baseInfo,
},
worker
);
});
logger.log("Base library loaded.");
// fetch code after loading base library
if (hasUrlParams) {
Expand Down
4 changes: 1 addition & 3 deletions src/contexts/WorkplaceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ export const workplaceReducer = {
/** Return updated state based on an action */
reduce(
state: WorkplaceState,
action: WorkplaceReducerAction,
worker
action: WorkplaceReducerAction
): WorkplaceState {
switch (action.type) {
case "loadProject":
Expand Down Expand Up @@ -248,7 +247,6 @@ export const workplaceReducer = {
};

delete files[action.payload.path];
worker.Moc({ type: "remove", file: action.payload.path });
return {
...state,
files,
Expand Down

0 comments on commit 2d07709

Please sign in to comment.