Skip to content

Conversation

@msmolens
Copy link
Owner

  • Update Svelte to 5.40.1 to make createContext available.
  • Replace calls to setContext and getContext with type-specific accessor functions created by createContext.
  • Update the Bookmark and Folder component tests to use dedicated wrapper components that set the context using the typed accessor functions.
  • Remove the legacy generic ContextWrapper wrapper component.

Replace calls to `setContext` and `getContext` with type-specific
accessor functions created by `createContext` [1].

Update the Bookmark and Folder component tests to use dedicated wrapper
components that set the context using the typed accessor functions.

Remove the legacy generic `ContextWrapper` wrapper component.

[1] sveltejs/svelte#16948
@msmolens msmolens marked this pull request as ready for review October 16, 2025 22:00
@msmolens msmolens requested a review from Copilot October 16, 2025 22:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the codebase from generic Svelte context APIs to type-safe context management using the new createContext function available in Svelte 5.40.1.

  • Updates Svelte version to 5.40.1 to access the new createContext API
  • Replaces all setContext/getContext calls with typed context accessor functions
  • Creates dedicated test wrapper components for Bookmark and Folder components that use the typed context setters

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Updates Svelte version from 5.39.11 to 5.40.1
src/treetop/context.ts Creates typed context accessor functions using createContext
src/treetop/Treetop.svelte Replaces setContext calls with typed setter functions
src/treetop/Folder.svelte Replaces getContext calls with typed getter functions
src/treetop/Bookmark.svelte Replaces getContext calls with typed getter functions
test/utils/BookmarkWrapper.svelte New wrapper component for testing Bookmark with typed context
test/utils/FolderWrapper.svelte New wrapper component for testing Folder with typed context
test/utils/ContextWrapper.svelte Removes legacy generic context wrapper
src/treetop/Bookmark.svelte.test.ts Updates test to use BookmarkWrapper instead of ContextWrapper
src/treetop/Folder.svelte.test.ts Updates test to use FolderWrapper instead of ContextWrapper
src/treetop/Treetop.svelte.test.ts Simplifies test by removing ContextWrapper usage
src/options/Options.svelte.test.ts Simplifies test by removing ContextWrapper usage
eslint.config.js Removes ContextWrapper from ESLint ignore list

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@msmolens msmolens merged commit 8a9c865 into main Oct 16, 2025
2 checks passed
@msmolens msmolens deleted the type-safe-context branch October 16, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants