Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 17, 2025

This PR completes the migration from Svelte 4 patterns to Svelte 5 Runes syntax while maintaining full functionality and backward compatibility.

Changes Made

Reactive State Migration

  • Contact.svelte: Converted form variables from regular let declarations to $state() for proper reactivity
  • Contact.svelte: Replaced $: reactive statement with $derived() for computed triggerContent
  • Hero.svelte: Replaced onMount() + store subscription pattern with $derived() using direct $mode access

Event Handler Modernization

  • Contact.svelte: Updated on:submit to onsubmit
  • Navbar.svelte: Updated on:click handlers to onclick

Before/After Examples

Contact Form (Before):

let contactForm: ContactFormProps = { /* ... */ };
let invalidInputForm = false;
$: triggerContent = subjects.find(s => s.value === contactForm.subject)?.label ?? "Select a subject";

Contact Form (After):

let contactForm = $state<ContactFormProps>({ /* ... */ });
let invalidInputForm = $state(false);
const triggerContent = $derived(subjects.find(s => s.value === contactForm.subject)?.label ?? "Select a subject");

Hero Component (Before):

let imageSrc = 'hero-image-light.jpg';
onMount(() => {
    mode.subscribe(currentMode => {
        imageSrc = currentMode === 'dark' ? 'hero-image-dark.jpg' : 'hero-image-light.jpg';
    });
});

Hero Component (After):

const imageSrc = $derived($mode === 'dark' ? 'hero-image-dark.jpg' : 'hero-image-light.jpg');

Testing

  • ✅ Project builds successfully with no errors
  • ✅ All interactive features tested (dark mode toggle, contact form, carousel)
  • ✅ Form reactivity verified (dropdown updates trigger computed values)
  • ✅ No breaking changes to user experience
  • ✅ Build output remains consistent

The migration adopts modern Svelte 5 patterns while keeping changes minimal and surgical. All existing functionality is preserved, and the app now fully leverages Svelte 5's new reactivity system.

Fixes #1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI self-assigned this Aug 17, 2025
Copy link
Author

Copilot AI commented Aug 17, 2025

@Zxce3 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 2 commits August 17, 2025 19:39
Co-authored-by: Zxce3 <57337800+Zxce3@users.noreply.github.com>
Co-authored-by: Zxce3 <57337800+Zxce3@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Migrate to Svelte 5 (Rune) Migrate to Svelte 5 Runes syntax Aug 17, 2025
@Copilot Copilot AI requested a review from Zxce3 August 17, 2025 19:47
Copilot finished work on behalf of Zxce3 August 17, 2025 19:47
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.

Migrate to Svelte 5 (Rune)
2 participants