Skip to content

feat: run formatter/prettier on launchpad's generated code in Editor - #975

Merged
Kevin101Zhang merged 1 commit into
mainfrom
974-run-formatterprettier-on-launchpads-generated-code-in-editor
Aug 6, 2024
Merged

Kevin101Zhang merged 1 commit into
mainfrom
974-run-formatterprettier-on-launchpads-generated-code-in-editor

Conversation

@Kevin101Zhang

Copy link
Copy Markdown
Contributor

No description provided.

@Kevin101Zhang Kevin101Zhang linked an issue Aug 2, 2024 that may be closed by this pull request
@Kevin101Zhang
Kevin101Zhang marked this pull request as ready for review August 2, 2024 21:42
@Kevin101Zhang
Kevin101Zhang requested a review from a team August 2, 2024 21:42
const codeResponse = await generateCode(wizardContractFilter, wizardMethods, wizardEvents);
setIndexingCode(codeResponse.jsCode);
setSchema(codeResponse.sqlCode);
const { validatedCode, validatedSchema } = reformatAll(codeResponse.jsCode, codeResponse.sqlCode);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since we handle and error throwing and check for properties within generateCode, we can safely assume the response is correct at this point so we can call for formatting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This use effect seems to be triggered by nothing? I'm confused when this runs. I'm mainly worried about the reformat changing the code suddenly for the user, which may be confusing.

@darunrs darunrs left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question here as well. I noticed that if I go to an indexer, the diff view compares the default code (the one where we do context.set on the block height) with my current code. Not my code when I opened the page, and my current code. Could you investigate that? Seeing as this PR is non-essential and small, it might be better to do that here.

Also, this PR is titled something related to formatting, but no files added to this PR have any formatting changes. Are you sure you added them? Otherwise, if the formatting was already correct, it should be re-titled to cover whatever DID change.

const codeResponse = await generateCode(wizardContractFilter, wizardMethods, wizardEvents);
setIndexingCode(codeResponse.jsCode);
setSchema(codeResponse.sqlCode);
const { validatedCode, validatedSchema } = reformatAll(codeResponse.jsCode, codeResponse.sqlCode);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This use effect seems to be triggered by nothing? I'm confused when this runs. I'm mainly worried about the reformat changing the code suddenly for the user, which may be confusing.

@Kevin101Zhang
Kevin101Zhang merged commit e67d2da into main Aug 6, 2024
@Kevin101Zhang
Kevin101Zhang deleted the 974-run-formatterprettier-on-launchpads-generated-code-in-editor branch August 6, 2024 21:47
@darunrs darunrs mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run formatter/prettier on launchpad's generated code in Editor

2 participants