Skip to content
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

feat: export the Root app in decap-cms-app, and add a flag to disable rendering #7368

Open
eoneill opened this issue Jan 9, 2025 · 0 comments
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@eoneill
Copy link

eoneill commented Jan 9, 2025

It would be awesome if decap-cms-app exposed the Root component defined in decap-cms-core, and introduced a flag to disable rendering the app by default.

Is your feature request related to a problem? Please describe.
Somewhat. Decap doesn't always play nicely when it is inside of another React rendering context. Instead of using react-dom to directly render decap into a DOM node, it would be great to simply expose the component and let the hosting React app handle the rendering.

Describe the solution you'd like

import DecapCMS, { Root as CMSApp } from 'decap-cms-core';

function MyReactComponent() {
  DecapCMS.init({ config, render: false });
  DecapCMS.registerPreviewTemplate(...);
  return (
    <div>
      <CMSApp/>
    </div>
  );
}

Describe alternatives you've considered
With a deeper refactor, it would probably be good to disable the auto-init stuff as well by default, which would give more control to the app.

The final solution could be entirely component based...

import { Root as CMSApp } from 'decap-cms-core';

function MyReactComponent() {
  return (
    <>
      <CMSApp config={...}/>
    </>
  );
}
@eoneill eoneill added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

1 participant