processing / processing/p5.js-website
CodeEmbed/frame.tsx: p5.sound never loads in iframes + postMessage uses wildcard origin
- Dominant language
- MDX
- Stars
- 96
- Forks
- 322
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 8
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- p5.strands
- WebGL
- DevOps, Build process, Unit testing
- Internationalization (i18n)
- Friendly Errors
- Other (specify if possible)
p5.js version
N/A - website repo issue, not p5.js core
Web browser and version
All browsers
Operating system
all
Issue :
Every time searchTerm changes, SearchProvider:
- fetches the entire search index JSON again
- flattens it
- creates a brand new Fuse instance
- runs the search
Typing "createVector" = 13 requests to the same en.json. No debounce,
no abort, no caching. The Fuse index is expensive to build and should
be created once per locale, not per keystroke.
There's also a race condition, no AbortController means a slow response
for "col" can resolve after "color" and overwrite the results.
Should be:
- fetch + build Fuse once per locale change, store in a ref
- separate effect just for running fuse.search(searchTerm)
- debounce the search (~250ms)
- AbortController on the fetch with cleanup
Easy to reproduce: open /search/, DevTools Network tab, type anything
fast and watch duplicate requests pile up.
File: src/components/SearchProvider/index.tsx
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.