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

chore(amis-editor): 编辑器配置面板支持异步加载 #7399

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

lurunze1226
Copy link
Collaborator

@lurunze1226 lurunze1226 commented Jul 6, 2023

What

🤖 Generated by Copilot at e7f3fc4

This pull request enhances the editor plugins with the ability to load their configuration panel content area lazily and show a custom fallback component while loading. It adds a new file AsyncLayer.tsx that exports a makeAsyncLayer function to wrap schema form render functions with React.lazy and React.Suspense. It also updates the plugin.ts file to use this function and modify the PluginInterface and the BasePlugin class accordingly.

🤖 Generated by Copilot at e7f3fc4

Oh, we are the coders of the sea
And we work on the editor plugins
We use makeAsyncLayer to load them with ease
And we show a fallback while we wait for the wins

Why

How

🤖 Generated by Copilot at e7f3fc4

  • Add a new file AsyncLayer.tsx that defines a function and an interface for enabling asynchronous loading of the configuration panel content area (link)
  • Import the omit function from lodash and the makeAsyncLayer function and the asyncLayerOptions interface from AsyncLayer.tsx in the plugin.ts file (link, link)
  • Add a new property async to the PluginInterface interface that allows each plugin to specify whether to enable asynchronous loading and provide the options for the fallback component (link)
  • Modify the renderPanel method of the BasePlugin class to check the async property of the plugin and wrap the schema form render function with the makeAsyncLayer function if enabled, or render it as before if not (link)

@github-actions github-actions bot added the chore label Jul 6, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@hsm-lv hsm-lv merged commit f5f5cac into baidu:master Jul 7, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants