-
Notifications
You must be signed in to change notification settings - Fork 70
[LG-5451] feat(code-editor): add preLoadedModules prop for synchronous module loading #3107
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
…nagement - Introduced a new `preLoadedModules` prop to the CodeEditor component, allowing users to provide pre-loaded modules instead of relying solely on lazy loading. - Implemented logic to determine missing required modules and issue console warnings if any are not provided, enhancing user feedback. - Updated the module loading process to utilize pre-loaded modules when available, improving performance and ensuring synchronous behavior. - Enhanced TypeScript definitions to include the new `preLoadedModules` prop, ensuring better type safety and clarity for users.
…s hook - Replaced the previous module loading approach with a new `useModules` hook to streamline the management of core and formatting modules. - Removed redundant code related to missing module checks and lazy loading, enhancing clarity and maintainability. - Updated the CodeEditor component to utilize the new hook, ensuring consistent module handling across functionalities. - Improved TypeScript definitions for better type safety and clarity in module management.
…ests - Introduced a new story, `WithPreLoadedModules`, to demonstrate the usage of pre-loaded modules in the CodeEditor component, enhancing the flexibility of module management. - Updated the `CodeEditor.spec.tsx` to include tests for rendering the editor with pre-loaded modules, ensuring immediate rendering and functionality. - Refactored the `useModules` hook to streamline module loading logic when pre-loaded modules are provided, improving performance and clarity. - Enhanced TypeScript definitions to support the new pre-loaded modules feature, ensuring better type safety and usability.
- Changed the test flag from `test.only` to `test` in `CodeEditor.spec.tsx` to ensure all tests run. - Introduced a new test suite for the `useModules` hook in `useModules.spec.ts`, covering scenarios for loading states and module retrieval based on provided pre-loaded modules. - Enhanced test coverage for module loading behavior, ensuring accurate handling of both provided and default modules.
…leteness - Revised the properties table in the CodeEditor README to enhance clarity and organization. - Added the `preLoadedModules` property to the table, providing details on its usage and type. - Ensured consistent formatting and alignment of property descriptions for improved readability. - Updated the documentation to reflect recent changes and features, ensuring users have accurate information on available props.
|
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 is meant to just extract all of the module loading logic out of the CodeEditor
component
Size Change: +178 B (+0.01%) Total Size: 2.04 MB
ℹ️ View Unchanged
|
…en-ui into LG-5451/cs-sync-modules
…s module loading (#3107) * feat(CodeEditor): add preLoadedModules support for improved module management - Introduced a new `preLoadedModules` prop to the CodeEditor component, allowing users to provide pre-loaded modules instead of relying solely on lazy loading. - Implemented logic to determine missing required modules and issue console warnings if any are not provided, enhancing user feedback. - Updated the module loading process to utilize pre-loaded modules when available, improving performance and ensuring synchronous behavior. - Enhanced TypeScript definitions to include the new `preLoadedModules` prop, ensuring better type safety and clarity for users. * refactor(CodeEditor): consolidate module loading logic with useModules hook - Replaced the previous module loading approach with a new `useModules` hook to streamline the management of core and formatting modules. - Removed redundant code related to missing module checks and lazy loading, enhancing clarity and maintainability. - Updated the CodeEditor component to utilize the new hook, ensuring consistent module handling across functionalities. - Improved TypeScript definitions for better type safety and clarity in module management. * feat(CodeEditor): add support for pre-loaded modules in stories and tests - Introduced a new story, `WithPreLoadedModules`, to demonstrate the usage of pre-loaded modules in the CodeEditor component, enhancing the flexibility of module management. - Updated the `CodeEditor.spec.tsx` to include tests for rendering the editor with pre-loaded modules, ensuring immediate rendering and functionality. - Refactored the `useModules` hook to streamline module loading logic when pre-loaded modules are provided, improving performance and clarity. - Enhanced TypeScript definitions to support the new pre-loaded modules feature, ensuring better type safety and usability. * test(CodeEditor): remove exclusive test flag and add useModules tests - Changed the test flag from `test.only` to `test` in `CodeEditor.spec.tsx` to ensure all tests run. - Introduced a new test suite for the `useModules` hook in `useModules.spec.ts`, covering scenarios for loading states and module retrieval based on provided pre-loaded modules. - Enhanced test coverage for module loading behavior, ensuring accurate handling of both provided and default modules. * docs(README): update CodeEditor properties table for clarity and completeness - Revised the properties table in the CodeEditor README to enhance clarity and organization. - Added the `preLoadedModules` property to the table, providing details on its usage and type. - Ensured consistent formatting and alignment of property descriptions for improved readability. - Updated the documentation to reflect recent changes and features, ensuring users have accurate information on available props.
…s module loading (#3107) * feat(CodeEditor): add preLoadedModules support for improved module management - Introduced a new `preLoadedModules` prop to the CodeEditor component, allowing users to provide pre-loaded modules instead of relying solely on lazy loading. - Implemented logic to determine missing required modules and issue console warnings if any are not provided, enhancing user feedback. - Updated the module loading process to utilize pre-loaded modules when available, improving performance and ensuring synchronous behavior. - Enhanced TypeScript definitions to include the new `preLoadedModules` prop, ensuring better type safety and clarity for users. * refactor(CodeEditor): consolidate module loading logic with useModules hook - Replaced the previous module loading approach with a new `useModules` hook to streamline the management of core and formatting modules. - Removed redundant code related to missing module checks and lazy loading, enhancing clarity and maintainability. - Updated the CodeEditor component to utilize the new hook, ensuring consistent module handling across functionalities. - Improved TypeScript definitions for better type safety and clarity in module management. * feat(CodeEditor): add support for pre-loaded modules in stories and tests - Introduced a new story, `WithPreLoadedModules`, to demonstrate the usage of pre-loaded modules in the CodeEditor component, enhancing the flexibility of module management. - Updated the `CodeEditor.spec.tsx` to include tests for rendering the editor with pre-loaded modules, ensuring immediate rendering and functionality. - Refactored the `useModules` hook to streamline module loading logic when pre-loaded modules are provided, improving performance and clarity. - Enhanced TypeScript definitions to support the new pre-loaded modules feature, ensuring better type safety and usability. * test(CodeEditor): remove exclusive test flag and add useModules tests - Changed the test flag from `test.only` to `test` in `CodeEditor.spec.tsx` to ensure all tests run. - Introduced a new test suite for the `useModules` hook in `useModules.spec.ts`, covering scenarios for loading states and module retrieval based on provided pre-loaded modules. - Enhanced test coverage for module loading behavior, ensuring accurate handling of both provided and default modules. * docs(README): update CodeEditor properties table for clarity and completeness - Revised the properties table in the CodeEditor README to enhance clarity and organization. - Added the `preLoadedModules` property to the table, providing details on its usage and type. - Ensured consistent formatting and alignment of property descriptions for improved readability. - Updated the documentation to reflect recent changes and features, ensuring users have accurate information on available props.
…s module loading (#3107) * feat(CodeEditor): add preLoadedModules support for improved module management - Introduced a new `preLoadedModules` prop to the CodeEditor component, allowing users to provide pre-loaded modules instead of relying solely on lazy loading. - Implemented logic to determine missing required modules and issue console warnings if any are not provided, enhancing user feedback. - Updated the module loading process to utilize pre-loaded modules when available, improving performance and ensuring synchronous behavior. - Enhanced TypeScript definitions to include the new `preLoadedModules` prop, ensuring better type safety and clarity for users. * refactor(CodeEditor): consolidate module loading logic with useModules hook - Replaced the previous module loading approach with a new `useModules` hook to streamline the management of core and formatting modules. - Removed redundant code related to missing module checks and lazy loading, enhancing clarity and maintainability. - Updated the CodeEditor component to utilize the new hook, ensuring consistent module handling across functionalities. - Improved TypeScript definitions for better type safety and clarity in module management. * feat(CodeEditor): add support for pre-loaded modules in stories and tests - Introduced a new story, `WithPreLoadedModules`, to demonstrate the usage of pre-loaded modules in the CodeEditor component, enhancing the flexibility of module management. - Updated the `CodeEditor.spec.tsx` to include tests for rendering the editor with pre-loaded modules, ensuring immediate rendering and functionality. - Refactored the `useModules` hook to streamline module loading logic when pre-loaded modules are provided, improving performance and clarity. - Enhanced TypeScript definitions to support the new pre-loaded modules feature, ensuring better type safety and usability. * test(CodeEditor): remove exclusive test flag and add useModules tests - Changed the test flag from `test.only` to `test` in `CodeEditor.spec.tsx` to ensure all tests run. - Introduced a new test suite for the `useModules` hook in `useModules.spec.ts`, covering scenarios for loading states and module retrieval based on provided pre-loaded modules. - Enhanced test coverage for module loading behavior, ensuring accurate handling of both provided and default modules. * docs(README): update CodeEditor properties table for clarity and completeness - Revised the properties table in the CodeEditor README to enhance clarity and organization. - Added the `preLoadedModules` property to the table, providing details on its usage and type. - Ensured consistent formatting and alignment of property descriptions for improved readability. - Updated the documentation to reflect recent changes and features, ensuring users have accurate information on available props.
…s module loading (#3107) * feat(CodeEditor): add preLoadedModules support for improved module management - Introduced a new `preLoadedModules` prop to the CodeEditor component, allowing users to provide pre-loaded modules instead of relying solely on lazy loading. - Implemented logic to determine missing required modules and issue console warnings if any are not provided, enhancing user feedback. - Updated the module loading process to utilize pre-loaded modules when available, improving performance and ensuring synchronous behavior. - Enhanced TypeScript definitions to include the new `preLoadedModules` prop, ensuring better type safety and clarity for users. * refactor(CodeEditor): consolidate module loading logic with useModules hook - Replaced the previous module loading approach with a new `useModules` hook to streamline the management of core and formatting modules. - Removed redundant code related to missing module checks and lazy loading, enhancing clarity and maintainability. - Updated the CodeEditor component to utilize the new hook, ensuring consistent module handling across functionalities. - Improved TypeScript definitions for better type safety and clarity in module management. * feat(CodeEditor): add support for pre-loaded modules in stories and tests - Introduced a new story, `WithPreLoadedModules`, to demonstrate the usage of pre-loaded modules in the CodeEditor component, enhancing the flexibility of module management. - Updated the `CodeEditor.spec.tsx` to include tests for rendering the editor with pre-loaded modules, ensuring immediate rendering and functionality. - Refactored the `useModules` hook to streamline module loading logic when pre-loaded modules are provided, improving performance and clarity. - Enhanced TypeScript definitions to support the new pre-loaded modules feature, ensuring better type safety and usability. * test(CodeEditor): remove exclusive test flag and add useModules tests - Changed the test flag from `test.only` to `test` in `CodeEditor.spec.tsx` to ensure all tests run. - Introduced a new test suite for the `useModules` hook in `useModules.spec.ts`, covering scenarios for loading states and module retrieval based on provided pre-loaded modules. - Enhanced test coverage for module loading behavior, ensuring accurate handling of both provided and default modules. * docs(README): update CodeEditor properties table for clarity and completeness - Revised the properties table in the CodeEditor README to enhance clarity and organization. - Added the `preLoadedModules` property to the table, providing details on its usage and type. - Ensured consistent formatting and alignment of property descriptions for improved readability. - Updated the documentation to reflect recent changes and features, ensuring users have accurate information on available props.
✍️ Proposed changes
This change adds a new
preLoadedModules
prop to the CodeEditor component that enables synchronous module loading by allowing consumers to pre-load required CodeMirror modules instead of relying on the default lazy loading behavior. This eliminates the initial loading state when all necessary modules are provided upfront.The implementation introduces a new
useModules
hook that consolidates the previous separate core and formatting module loading logic, providing a unified interface that handles both pre-loaded modules and lazy loading scenarios with proper fallback behavior.🎟️ Jira ticket: LG-5451
✅ Checklist
pnpm changeset
and documented my changes🧪 How to test changes
Test the new preLoadedModules prop:
Test backward compatibility:
Test console warnings:
Run the test suite:
pnpm test packages/code-editor
🎟 Jira ticket: LG-5451