-
Notifications
You must be signed in to change notification settings - Fork 37
Update examples sub-repo #119
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
Conversation
✅ Deploy Preview for react-datocms-example ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
examples/public/index.html
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with the Vite version at /index.html
| return ( | ||
| <div className="example" data-title="Full-blown example"> | ||
| <Helmet>{renderMetaTags(metaTags)}</Helmet> | ||
| {renderMetaTags(metaTags)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React 19 should support this now: https://react.dev/blog/2024/12/05/react-19#support-for-metadata-tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I regenerated the whole thing from scratch to make sure we have no orphans in it
| "eject": "react-scripts eject" | ||
| "start": "vite", | ||
| "build": "vite build", | ||
| "setup": "echo 'Setup is no longer necessary in this version, skipping...'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also modify the Netlify build command to remove this step
| "@datocms/cma-client-browser": "^5.2.1", | ||
| "react": "^19.2.3", | ||
| "react-datocms": "^7.2.4", | ||
| "react-dom": "^19.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to more realistically include it from npm, I think, for people who don't want to build the whole monorepo (parent repo) and just want to use the examples. The setup step and file-based transclusion is kinda messy....
| base: './', | ||
| plugins: [react()], | ||
| build: { | ||
| outDir: "build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be explicitly specified for backward compatibility with react-script's default folder
|
Thanks for the fix 🙏 if you're taking suggestions, there's also what looks like a debugging line left in the image examples: react-datocms/examples/src/ImageExamples/index.jsx Lines 52 to 60 in 4412919
|
Not sure what that's about... 🤷 Removed it for now in 5320502, but @stefanoverna may add it back if there's a good reason for it? |

Fix #118
The examples page was no longer rendering.
This updates it to use the latest React version and Vite instead of react-scripts.
Works again after the update: https://deploy-preview-119--react-datocms-example.netlify.app/