Skip to content

Commit

Permalink
fix realms fetch performance (solana-labs#1157)
Browse files Browse the repository at this point in the history
* fix realms fetch performance

* fix yarn lock
  • Loading branch information
abrzezinski94 authored Oct 31, 2022
1 parent a7903be commit 6558213
Show file tree
Hide file tree
Showing 7 changed files with 1,076 additions and 860 deletions.
4 changes: 2 additions & 2 deletions actions/createProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ export const createProposal = async (
)

const signersSet = [
[...prerequisiteInstructionsSigners],
...chunks([...prerequisiteInstructionsSigners], 5),
[],
...signerChunks,
]
const txes = [
deduplicatedPrerequisiteInstructions,
...chunks(deduplicatedPrerequisiteInstructions, 5),
instructions,
...insertChunks,
].map((txBatch, batchIdx) => {
Expand Down
4 changes: 3 additions & 1 deletion components/TreasuryAccount/SendTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ const SendTokens = ({
setIsLoading(false)
throw 'No realm selected'
}
const instructionData = {
const instructionData: InstructionDataWithHoldUpTime = {
data: instruction.serializedInstruction
? getInstructionDataFromBase64(instruction.serializedInstruction)
: null,
holdUpTime: governance?.account?.config.minInstructionHoldUpTime,
prerequisiteInstructions: instruction.prerequisiteInstructions || [],
chunkSplitByDefault: true,
chunkBy: 4,
}
instructions.push(instructionData)
}
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const customConfig = {
moduleNameMapper: directories,
setupFilesAfterEnv: ['<rootDir>/test/setup.js'],
moduleDirectories: ['node_modules', '<rootDir>/'],
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}

module.exports = nextJest({ dir: './' })(customConfig)
2 changes: 1 addition & 1 deletion models/registry/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function getUnchartedRealmInfos(connection: ConnectionContext) {
).map((p) => {
return p.programId
})
getRealms(connection.current, programIds)

const allRealms = (
await getRealms(connection.current, programIds)
).sort((r1, r2) => r1.account.name.localeCompare(r2.account.name))
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"@testing-library/react": "^11.2.5",
"@types/carbon__icons-react": "^11.7.0",
"@types/d3": "^7.4.0",
"@types/jest": "^27.4.1",
"@types/jest": "^29.2.0",
"@types/js-cookie": "^3.0.2",
"@types/node": "^14.14.25",
"@types/react": "^17.0.44",
Expand All @@ -172,13 +172,15 @@
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.5.0",
"husky": "^8.0.1",
"jest": "^27.4.5",
"jest": "^29.2.0",
"jest-environment-jsdom": "^29.2.2",
"lint-staged": "^10.0.10",
"next-router-mock": "^0.6.7",
"postcss": "^8.4.12",
"postcss-preset-env": "^6.7.0",
"prettier": "2.2.1",
"tailwindcss": "^3.0.23",
"ts-jest": "29.0.3",
"ts-loader": "^9.3.1",
"twin.macro": "^2.4.0",
"typescript": "^4.6.3"
Expand Down
2 changes: 1 addition & 1 deletion pages/realms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Realms = () => {
if (selectedRealm.realm) {
actions.deselectRealm()
}
}, [connection])
}, [connection.cluster, connection.endpoint, connection.current.commitment])

const handleCreateRealmButtonClick = async () => {
if (!connected) {
Expand Down
Loading

0 comments on commit 6558213

Please sign in to comment.