Skip to content

client/modules/Preview: migrate to TypeScript, no-verify#3879

Open
NalinDalal wants to merge 13 commits intoprocessing:developfrom
NalinDalal:develop
Open

client/modules/Preview: migrate to TypeScript, no-verify#3879
NalinDalal wants to merge 13 commits intoprocessing:developfrom
NalinDalal:develop

Conversation

@NalinDalal
Copy link

Fixes #3828

Changes:

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

@release-com
Copy link

release-com bot commented Feb 13, 2026

Release Environments

This Environment is provided by Release, learn more!
To see the status of the Environment click on Environment Status below.

🔧Environment Status : https://app.release.com/public/Processing%20Foundation/env-a804a46e79

Copy link
Contributor

@yugalkaushik yugalkaushik left a comment

Choose a reason for hiding this comment

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

Hi @NalinDalal Thank you for the PR. The type annotations are clean and the file-by-file conversion makes sense. There are a couple issues with the code that needs to be fixed, I pointed out few myself but still there can be multiple problem. So after the requested changes please understand the structure and check nothing is broken with proper testing.

function PreviewApp() {
const [files, setFiles] = useState<File[]>([]);
const [isPlaying, setIsPlaying] = useState(false);
const [basePath, setBasePath] = useState('/');
Copy link
Contributor

Choose a reason for hiding this comment

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

The old code had useState('') (empty string). Changing the default to '/' is a silent behaviour change, unless you thought of intentional reason for this change it should stay '' to match the original.

useEffect(() => {
function handleMessage(message: any) {
switch (message.type) {
case MessageTypes.REGISTER:
Copy link
Contributor

Choose a reason for hiding this comment

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

The MessageTypes.EXECUTE case from the original previewIndex.jsx is completely missing please check it out.

}
}

function addCacheBustingToAssets(files) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This block is completely missing from previewIndex.tsx, please checkout the entire file I can still see many issues.

@@ -8,6 +8,41 @@ declare module '*.svg' {
export default ReactComponent;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a conflict here. You're adding types/blob-util in package.json AND manually declaring blob-util in custom.d.ts. These two type sources will conflict.
either remove the manual declare module 'blob-util' block from custom.d.ts and let @types/blob-util handle it, or drop @types/blob-util from package.json and fix the declaration here to include a default export.

"jsx": "react",
},
"include": ["./**/*"],
"types": ["node"] },
Copy link
Contributor

Choose a reason for hiding this comment

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

The formatting here is broken please fix it

Copy link
Contributor

Choose a reason for hiding this comment

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

This file should not be in this PR

}

export function filesReducer(state, action) {
export function filesReducer(state: FileState, action: FilesAction): FileState {
Copy link
Contributor

Choose a reason for hiding this comment

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

The filesReducer function is still exported but previewIndex.tsx no longer uses useReducer, it uses plain useState + createBlobUrls directly.

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.

TypeScript migration: client/modules/Preview

2 participants