Skip to content

Commit cb6f9da

Browse files
authored
Merge pull request #201 from theahaco/fix/ci-issue
Fix CI issue
2 parents 6a4d57f + 6ee3003 commit cb6f9da

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ jobs:
4242
else
4343
echo "stellar-scaffold already installed. Clear cache to force reinstall."
4444
fi
45+
- name: Start Stellar local network
46+
uses: stellar/quickstart@main
47+
with:
48+
enable: "core,rpc"
49+
- name: Add master account as default identity
50+
run: |
51+
mkdir -p .config/stellar/identity
52+
echo 'secret_key = "SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L"' > .config/stellar/identity/me.toml
4553
- run: npm ci
4654
- run: npm run lint
4755
- run: npx prettier . --check

src/components/GuessTheNumber.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const GuessTheNumber = () => {
2929
// Create a transaction using the contract client
3030
const tx = await game.guess(
3131
{ a_number: BigInt(guess), guesser: address },
32-
// @ts-expect-error js-stellar-sdk has bad typings; publicKey is, in fact, allowed
3332
{ publicKey: address },
3433
)
3534

src/hooks/useSubscription.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ export function useSubscription(
3636
pollInterval = 5000,
3737
) {
3838
const id = `${contractId}:${topic}`
39-
paging[id] = paging[id] || {}
39+
if (!paging[id]) paging[id] = {}
40+
const page = paging[id]
4041

4142
React.useEffect(() => {
4243
let timeoutId: NodeJS.Timeout | null = null
4344
let stop = false
4445

4546
async function pollEvents(): Promise<void> {
4647
try {
47-
if (!paging[id].lastLedgerStart) {
48+
if (!page.lastLedgerStart) {
4849
const latestLedgerState = await server.getLatestLedger()
49-
paging[id].lastLedgerStart = latestLedgerState.sequence
50+
page.lastLedgerStart = latestLedgerState.sequence
5051
}
5152

52-
// lastLedgerStart is now guaranteed to be a number
53-
const lastLedger = paging[id].lastLedgerStart
53+
const lastLedger = page.lastLedgerStart
5454

5555
const response = await server.getEvents(
56-
paging[id].pagingToken
56+
page.pagingToken
5757
? {
58-
cursor: paging[id].pagingToken,
58+
cursor: page.pagingToken,
5959
filters: [
6060
{
6161
contractIds: [contractId],
@@ -79,9 +79,9 @@ export function useSubscription(
7979
},
8080
)
8181

82-
paging[id].pagingToken = undefined
82+
page.pagingToken = undefined
8383
if (response.latestLedger) {
84-
paging[id].lastLedgerStart = response.latestLedger
84+
page.lastLedgerStart = response.latestLedger
8585
}
8686
if (response.events && response.events.length > 0) {
8787
response.events.forEach((event) => {
@@ -94,9 +94,8 @@ export function useSubscription(
9494
)
9595
}
9696
})
97-
// Store the cursor from the response for pagination
9897
if (response.cursor) {
99-
paging[id].pagingToken = response.cursor
98+
page.pagingToken = response.cursor
10099
}
101100
}
102101
} catch (error) {

0 commit comments

Comments
 (0)