workbenchapp / solana-workbench

Your one-stop shop for developing on Solana
MIT License
63 stars 7 forks source link

Clean up token page when no data #241

Closed SvenDowideit closed 2 years ago

SvenDowideit commented 2 years ago

closes #232 closes #209

nathanleclaire commented 2 years ago

I'm having a hard time testing this, cause something on main seems to blow up when I go to Tokens page --

Screen Shot 2022-07-15 at 10 02 38 AM

I'll have a looksie and see if I can spot the issue

(Side note, my screen goes black and I can't navigate anywhere when that happens, can we prevent that type of thing from happening somehow?)

nathanleclaire commented 2 years ago

Weird, it's grumpy about mintPubkey being undefined, and my VSCode complains about string | undefined, so I wonder if we might have caught that bug somehow.

Screen Shot 2022-07-15 at 10 05 08 AM

Did our CI drop the ball somewhere?

nathanleclaire commented 2 years ago

mmm, I think it's related to the ~100 errors we see with npm exec tsc directly, which is known issue from vite port iirc? do we have something to track that anywhere?

Screen Shot 2022-07-15 at 10 26 27 AM

Do our existing tsc commands in npm run lint even do anything anymore?

bluskript commented 2 years ago

The problem is that npx run tsc isn't accurate because there is a tsconfig.json sitting inside of the renderer directory. I think this can be resolved by adding **.* to "include" in that json file, but yea running tsc directly will use the root tsconfig which isn't accurate.

nathanleclaire commented 2 years ago

The problem is that npx run tsc isn't accurate because there is a tsconfig.json sitting inside of the renderer directory. I think this can be resolved by adding *. to "include" in that json file, but yea running tsc directly will use the root tsconfig which isn't accurate.

I don't follow you. It isn't accurate how? It's printing what seem to be a bunch of valid errors. And the main and renderer tsconfigs look like they link back to the root one using "extends": "../../tsconfig.json".

SvenDowideit commented 2 years ago

oh yay, frustrating.

SvenDowideit commented 2 years ago

@nathanleclaire so I get the

MetaplexTokenData.tsx:29 Uncaught TypeError: Cannot read properties of undefined (reading 'toString')
    at DataPopover (MetaplexTokenData.tsx:29:29)
    at MetaplexTokenDataButton (MetaplexTokenData.tsx:214:16)

WTF?

the code in question looks like

function DataPopover(props: { mintPubKey: sol.PublicKey }) {
  const { mintPubKey } = props;
  const selectedWallet = useWallet();
  const { connection } = useConnection();
  const { net } = useAppSelector(selectValidatorNetworkState);

  const pubKey = mintPubKey.toString();

so assuming we're typesafe, because magic unicorn TypeScript, mintPubKey: sol.PublicKey should mean that no, mintPubKey isn't allowed to be undefined. and yet ... its undefined?

er, its 10 years since i last wrote a rant about "typescript". FRUSTRATED.

(and no, its not good enough for npm run lint, tsc -p ./src/renderer, and tsc -p ./src/main to say :+1:, no errors, but hidden in a gui IDE, is MetaplexTokenData.tsx(23, 31): The expected type comes from property 'mintPubKey' which is declared here on type '{ mintPubKey: PublicKey; }'

argh!

nathanleclaire commented 2 years ago

Yea same when I tested, seems to be a problem on main.

Got distracted w/ the TS errors, but we should just wait until after 0.4.0 to chip away at those.

SvenDowideit commented 2 years ago

ok, made https://github.com/workbenchapp/solana-workbench/pull/247 for that

SvenDowideit commented 2 years ago

no this is holding up too many other things. merging.