Skip to content

Commit

Permalink
Updated flake; package-deployed script; bumped version; fixed async call
Browse files Browse the repository at this point in the history
  • Loading branch information
Zequez committed Dec 31, 2024
1 parent a3b2b66 commit fb41a63
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
26 changes: 13 additions & 13 deletions flake.lock

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"",
"test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests",
"package": "npm run build:happ && npm run package -w ui && hc web-app pack workdir --recursive",
"package:download-deployed": "if [ ! -f workdir/deployed.happ ]; then curl -L -o workdir/deployed.webhapp https://github.com/holochain-apps/gamez/releases/download/v0.7.2/gamez.webhapp && hc web-app unpack -o workdir/deployed workdir/deployed.webhapp && cp workdir/deployed/gamez.happ workdir/deployed.happ && rm -rf workdir/ui workdir/deployed; fi",
"package:download-deployed": "if [ ! -f workdir/deployed.happ ]; then curl -L -o workdir/deployed.webhapp https://github.com/holochain-apps/gamez/releases/download/v0.7.7/gamez.webhapp && hc web-app unpack -o workdir/deployed workdir/deployed.webhapp && cp workdir/deployed/gamez.happ workdir/deployed.happ && rm -rf workdir/ui workdir/deployed; fi",
"package:deployed": "npm run package:download-deployed && npm run package -w ui && cp workdir/deployed.happ workdir/gamez.happ && hc web-app pack workdir",
"package:test": "npm run package:download-deployed && cp workdir/deployed.happ workdir/gamez.happ",
"launch:happ": "hc-spin -n $AGENTS workdir/gamez.happ --ui-port $UI_PORT ",
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.7.7",
"version": "0.7.8",
"dnaVersion": "0.6.0",
"scripts": {
"start": "vite --clearScreen false --port $UI_PORT",
Expand Down
44 changes: 23 additions & 21 deletions ui/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ import './app.css';
import App from './App.svelte';
import { appletServices } from './we';

if ((import.meta as any).env.DEV) {
try {
await initializeHotReload();
} catch (e) {
console.warn(
'Could not initialize applet hot-reloading. This is only expected to work in a We context in dev mode.',
);
(async () => {
if ((import.meta as any).env.DEV) {
try {
await initializeHotReload();
} catch (e) {
console.warn(
'Could not initialize applet hot-reloading. This is only expected to work in a We context in dev mode.',
);
}
}
}

const weaveClient = isWeaveContext() ? await WeaveClient.connect(appletServices) : null;
const weaveClient = isWeaveContext() ? await WeaveClient.connect(appletServices) : null;

let app: App = null;
function handleVisibilityChange() {
if (app) return;
let app: App = null;
function handleVisibilityChange() {
if (app) return;

if (document.visibilityState === 'visible') {
app = new App({
target: document.body,
props: { weaveClient },
});
document.removeEventListener('visibilitychange', handleVisibilityChange);
if (document.visibilityState === 'visible') {
app = new App({
target: document.body,
props: { weaveClient },
});
document.removeEventListener('visibilitychange', handleVisibilityChange);
}
}
}

handleVisibilityChange();
document.addEventListener('visibilitychange', handleVisibilityChange);
handleVisibilityChange();
document.addEventListener('visibilitychange', handleVisibilityChange);
})();

0 comments on commit fb41a63

Please sign in to comment.