Skip to content

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

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

syedbarkath980 wants to merge 2 commits 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

@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?

@syedbarkath980
syedbarkath980 force-pushed the fix/4344-default-html-function-reference branch from 08a671f to 5094d6b Compare November 1, 2026 14:06
@clairep94

Copy link
Copy Markdown
Collaborator

Thanks @syedbarkath980 again for the quick response!

I think let's update the PR to do the defaultHTML({ version: '1.11.13' }) patch fix

Could you please also create the following new issues?

  • Add column to display p5 version to sketch list & add filter/sorting by p5 version to sketch list
  • Update Example Sketches to include p5 v2 examples
    • Note that when users click on a sketch, its associated version should be used, rather than a hardcoded version number

@syedbarkath980
syedbarkath980 force-pushed the fix/4344-default-html-function-reference branch from dd5f5c0 to 8525d8b Compare November 2, 2026 08:51
@syedbarkath980

Copy link
Copy Markdown
Author

Hi @clairep94 i have updated the PR to do the defaultHTML({ version: '1.11.13' }) patch fix.

For the issues you asked me to create:

  • Add column to display p5 version to sketch list & add filter/sorting by p5 version to sketch list
  • Update Example Sketches to include p5 v2 examples

There is already 2 issues exists for the same:
#4106
#4313

Should i still go ahead and create these issues?

This branch is waiting to be deployed

1 waiting (outdated) deployment
e2e-tests — 5094d6b7 Waiting Nov 1, 2026 by syedbarkath980 via test-e2e #455
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