mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(account-data-editor): resolve Ace editor loading failure
Load react-ace before mode/theme to avoid 'ace is not defined' race. Unwrap Vite CJS double-default export for correct component reference. Use save_changes translation key for Save button.
This commit is contained in:
@@ -8,8 +8,11 @@ import styles from './account-data-editor.module.css';
|
|||||||
const DEFAULT_RETURN_TO = '/subs/settings#account-settings';
|
const DEFAULT_RETURN_TO = '/subs/settings#account-settings';
|
||||||
|
|
||||||
const loadAce = async () => {
|
const loadAce = async () => {
|
||||||
const [aceModule] = await Promise.all([import('react-ace'), import('ace-builds/src-noconflict/mode-json'), import('ace-builds/src-noconflict/theme-monokai')]);
|
const aceModule = await import('react-ace');
|
||||||
return aceModule.default;
|
await Promise.all([import('ace-builds/src-noconflict/mode-json'), import('ace-builds/src-noconflict/theme-monokai')]);
|
||||||
|
// Vite CJS interop can double-wrap the default export
|
||||||
|
const mod = aceModule.default;
|
||||||
|
return typeof mod === 'function' ? mod : (mod as unknown as { default: typeof mod }).default;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AccountDataEditor = () => {
|
const AccountDataEditor = () => {
|
||||||
@@ -103,7 +106,7 @@ const AccountDataEditor = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.controls}>
|
<div className={styles.controls}>
|
||||||
<button type='button' onClick={handleSave}>
|
<button type='button' onClick={handleSave}>
|
||||||
{t('save')}
|
{t('save_changes')}
|
||||||
</button>
|
</button>
|
||||||
<button type='button' onClick={handleReset}>
|
<button type='button' onClick={handleReset}>
|
||||||
{t('reset_changes')}
|
{t('reset_changes')}
|
||||||
|
|||||||
Reference in New Issue
Block a user