Skip to content

Fix: example.js stores defaultHTML function reference instead of calling it - #4395

Open
syedbarkath980 wants to merge 1 commit into
processing:developfrom
syedbarkath980:fix/4344-default-html-function-reference
Open

syedbarkath980 wants to merge 1 commit into
processing:developfrom
syedbarkath980:fix/4344-default-html-function-reference

Conversation

@syedbarkath980

Copy link
Copy Markdown

Issue:

Fixes #4344

Description

This PR fixes an issue where the defaultHTML function reference was assigned directly to the content property of the default index.html file instead of invoking the function to retrieve its returned HTML string.

As a result, examples displayed the raw JavaScript function source in the preview instead of rendering the expected HTML page and p5.js sketch.

The fix invokes defaultHTML() so that the generated HTML content is correctly stored in the project.

Before

improper.defaultHTML.function.call.Before.fix.mp4

After

improper.defaultHTML.function.call.After.fix.mp4

The above video demonstrate that sketch correctly renders the HTML page.

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

@syedbarkath980
syedbarkath980 force-pushed the fix/4344-default-html-function-reference branch from f83b34b to 08a671f Compare October 31, 2026 05:23
@clairep94

Copy link
Copy Markdown
Collaborator

Hi @syedbarkath980 this looks good, thanks for fixing so quickly!

Would you be able to update your demo to just check that /all/ the example sketches work as expected?
Reasoning is that they're quite old and are on p5 v1.11.13, and the editor now is on v2 as default.

If any of them don't work, maybe we should update to defaultHTML({ version: '1.11.13' }) as a patch. Or simply delete any outdated p5v1 example sketches to reduce maintainence?

Thoughts @doradocodes @ksen0?

@clairep94 clairep94 self-assigned this Oct 31, 2026
@syedbarkath980

Copy link
Copy Markdown
Author

@clairep94 i tried to run other "Example Sketches" as well but getting this error:

temperrors.mp4

i applied your suggested patch: defaultHTML({ version: '1.11.13' }) and regenerate the sketches and tested once again and with this patch every sketch was working fine except only one:

temperrors.fix.after.patch.mp4

In the previous "After Fix" video i did not shown the sketches which was giving errors because i thought that was unrelated to PR.

What should i do now? should i commit with the suggested patch version?

This branch was successfully deployed

1 active deployment
e2e-tests — 08a671f2 Deployed Oct 31, 2026 by syedbarkath980 via test-e2e #446
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.

Fix: example.js stores defaultHTML function reference instead of calling it, causing examples to display raw JavaScript source in preview

2 participants