Skip to content

Commit

Permalink
fix thrown error on name save, org-specific collectibles
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhallock committed Jun 29, 2023
1 parent 94290d5 commit 7b6916d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stream-projects/mogul-menu-v2/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { React, UrqlProvider } from "./deps.ts";
import { toDist } from "https://tfl.dev/@truffle/distribute@^2.0.0/format/wc/react/index.ts"; // DO NOT BUMP
import Menu from "./components/menu/menu.tsx";
import { truffleApp, user$ } from "./shared/util/truffle/truffle-app.ts";
import { observer } from "https://npm.tfl.dev/@legendapp/state@1.2.8/react";
import { observer } from "https://npm.tfl.dev/@legendapp/state@~0.19.0/react";

const iconImageObj = {
id: "f38e1f40-fe27-11ec-8613-c8d0b98b6415",
Expand Down
2 changes: 1 addition & 1 deletion stream-projects/mogul-menu-v2/src/shared/util/general.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { observable } from "https://npm.tfl.dev/@legendapp/state@1.2.8";
import { observable } from "https://npm.tfl.dev/@legendapp/state@~0.19.0";

export const ONE_MINUTE_S = 60;
export const ONE_HOUR_S = 3600;
Expand Down
11 changes: 10 additions & 1 deletion stream-projects/mogul-menu-v2/src/shared/util/graphql/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ export function useUrqlQuerySignal(query: any, variables?: any, args?: any) {
const signal$ = useSignal(result);

useEffect(() => {
signal$.set(result);
// HACK: i have no clue why, but the .set here throws a can't read .get of undefined
// when account settings (eg name) are changed. (the error points to this bit of code, not a separate .get)
// don't have time to look into deeper now, but not setting hwne it errors seems to be fine
// for now.
// there's a chance it's from using an nolder version of legend, but bumping to 1 breaks other things
try {
signal$.set(result);
} catch (err) {
console.warn('state didn\'t save', err);
}
}, [result]);

return { signal$, reexecuteQuery };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { org$ } from "./truffle-app.ts";

export function getOrgId() {
return "";
// NOTE: this isn't perfect sync it's async after page load, but i think good enough for
// all we use getOrgId for
return org$.get()?.id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ function initApp() {

export const truffleApp = initApp();
export const user$ = fromSpecObservable(truffleApp.user.observable);
export const org$ = fromSpecObservable(truffleApp.org.observable);

0 comments on commit 7b6916d

Please sign in to comment.