Skip to content

solid-codemirror@2.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 30 Oct 21:12
· 22 commits to main since this release
0a96919

This version of solid-codemirror introduces a new helper: createLazyCompartmentExtension. This new helper will not introduce any magic at all, it will just provide a cleaner syntax to support extensions returning a Promise.

// ✅ 1. Remove the static import
// import { largeExtension } from './large-extension';
import { createLazyCompartmentExtension } from './createLazyCompartmentExtension';
import { Show } from 'solid-js';

function App() {
  const [code, setCode] = createSignal("console.log('hello world!')");
  const { ref, createExtension } = createCodeMirror({ onValueChange: setCode });

  // ✅ 2. Call the helper providing a Promise<Extension>
  // The extension will be configured only after the Promise resolves
  const largeExt = createLazyCompartmentExtension(
    () => import('./large-extension').then(res => res.largeExtension)
  );

  return (
    <div>
      <div ref={ref} />
      {/*✅ 3. You can read the pending state of the Promise*/}
      <Show when={largeExt.loading}>
        Loading...
      </Show>
    </div>
  )
}

Minor Changes

  • 06762fe: feat: add support for lazy compartment extensions