Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: manual-edits.json file added to dropdown #134

Merged
merged 6 commits into from
Oct 29, 2024

Conversation

imrishabh18
Copy link
Member

Screenshot 2024-10-29 at 5 07 07 PM

@imrishabh18 imrishabh18 requested a review from seveibar as a code owner October 29, 2024 11:37
Copy link

vercel bot commented Oct 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
snippets ⬜️ Ignored (Inspect) Visit Preview Oct 29, 2024 3:02pm

@imrishabh18 imrishabh18 changed the title feat: manual-edits.json is now editable feat: manual-edits.json file added to dropdown Oct 29, 2024
Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

Note before merging: there is an important change that will break production with the apiUrl, make sure to revert that line!

Look good, i think more code is now in CodeEditor when our goal should be to reduce the size of CodeEditor since its so complex. Could we make the CodeEditorHeader a separate component to hopefully start to break down that massive component?

@@ -93,10 +117,9 @@ export const CodeEditor = ({
const pathInPackage = fullPackageName.split("/").slice(1).join("/")
const jsdelivrPath = `${packageName}${pathInPackage ? `/${pathInPackage}` : ""}`
return fetch(
`${apiUrl}/snippets/download?jsdelivr_resolve=${input.includes("/resolve/")}&jsdelivr_path=${encodeURIComponent(jsdelivrPath)}`,
`/snippets/download?jsdelivr_resolve=${input.includes("/resolve/")}&jsdelivr_path=${encodeURIComponent(jsdelivrPath)}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This apiUrl is important, without it production wont go to the right server

})
}
}
}, [code])
}, [files, currentFile])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should probably keep this the same, we could also make "code = files["index.tsx"]

Suggested change
}, [files, currentFile])
}, [files["index.tsx"]])

This code sometimes can cause the cursor to jump while editing if it fires too often, or typescript to not be typechecked if it fires late

if (ataRef.current) {
ataRef.current(code)
if (ataRef.current && currentFile === "index.tsx") {
ataRef.current(`${DEFAULT_IMPORTS}${files["index.tsx"]}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep the "code" alias to simplify the diff imo

@seveibar
Copy link
Contributor

Another random note, this code can be a bit sensitive to changes, so definitely test stuff like editing code and making sure new typescript imports are recognized and dynamically imported etc. also that the cursor is stable when editing.

We could potentially incorporate that into a playwright test later

@imrishabh18
Copy link
Member Author

Editing and formatting, both are looking good.

Screen.Recording.2024-10-29.at.8.23.26.PM.mov

@imrishabh18 imrishabh18 merged commit b751e7f into main Oct 29, 2024
5 checks passed
@imrishabh18 imrishabh18 deleted the feat/new-file-editor-added branch October 29, 2024 15:05
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.

2 participants