Skip to content

refactor: Get Thunderstore package API response from backend#168

Merged
Alystrasz merged 9 commits intomainfrom
refactor/ts-api-fetch-backend
Feb 13, 2023
Merged

refactor: Get Thunderstore package API response from backend#168
Alystrasz merged 9 commits intomainfrom
refactor/ts-api-fetch-backend

Conversation

@GeckoEidechse
Copy link
Member

@GeckoEidechse GeckoEidechse commented Feb 6, 2023

Previously Thunderstore package index was done in frontend. Should be moved to backend instead as backend is reponsible for such tasks while frontend should just be used to store and display information.

Closes #164
Closes #120 cause filtering no longer happens in frontend but instead in backend.

Previously Thunderstore package index was done in frontend. Should be moved to backend instead as backend is reponsible for such tasks while frontend should just be used to store and display information.
@GeckoEidechse
Copy link
Member Author

@Alystrasz any idea how to get rid of the undefined warning?

image

Trying to use an if-guard just gives another error :(

image

Makes it more descriptive what it does
Replaces the current TypeScript interface defintions with autogenerated bindings.
@GeckoEidechse GeckoEidechse marked this pull request as ready for review February 6, 2023 14:32
@GeckoEidechse
Copy link
Member Author

CI failing cause Ubuntu Azure repos are down (still) and cause of TypeScript warning mentioned in #168 (comment) that I will need assistance with to solve.

@Alystrasz
Copy link
Collaborator

Alystrasz commented Feb 6, 2023

@Alystrasz any idea how to get rid of the undefined warning?

You need to initialize your mods variable, and type it as an array of Thunderstore mods.
Then, instead of checking if mods is undefined (which isn't a good practice btw), you can check if the list is empty:

let mods: ThunderstoreMod[] = []; await invoke<ThunderstoreMod[]>("query_thunderstore_packages_api") .then((message) => { mods = message; }) .catch((error) => { console.error(error); return; }); if (mods.length === 0) { return; }
@GeckoEidechse
Copy link
Member Author

You need to initialize your mods variable, and type it as an array of Thunderstore mods.

Thanks for the clarification, fixed in 394f561. Empty check isn't needed then anyway cause it's implicitly handled due it being an (empty) array. ^^

i32 should be big enough unless Thunderstore and Northstar suddenly becomes really huge and we start seeing over 4 million downloads on some mod
@GeckoEidechse
Copy link
Member Author

Assuming CI passes now, this PR should be done and ready for review ^^

@GeckoEidechse
Copy link
Member Author

Ok, now it should be fixed ^^"

Copy link
Collaborator

@Alystrasz Alystrasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Confirmed working on Windows.

@Alystrasz Alystrasz merged commit 2bdc602 into main Feb 13, 2023
@Alystrasz Alystrasz deleted the refactor/ts-api-fetch-backend branch February 13, 2023 23:00
@GeckoEidechse GeckoEidechse changed the title refactor: Get TS package API response from backend refactor: Get Thunderstore package API response from backend Mar 2, 2023
@GeckoEidechse GeckoEidechse mentioned this pull request Mar 2, 2023
100 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants