Advertisement · 728 × 90

Posts by Erik V

// Handle manual activation (when user clicks the video thumbnail directly)
	async function handleManualActivation(event: Event) {
		if (activated) return;

		// Let the lite-youtube component's own click handler run first
		await new Promise((resolve) => setTimeout(resolve, 0));

		activated = true;

		// Poll for playerPromise to be set, then wait for it to resolve
		try {
			// Poll for playerPromise to exist (set by addYTPlayerIframe)
			let attempts = 0;
			const maxAttempts = 50; // 5 seconds max

			while (attempts < maxAttempts && !(liteYoutubeEl as any).playerPromise) {
				await new Promise((resolve) => setTimeout(resolve, 100));
				attempts++;
			}

			if (!(liteYoutubeEl as any).playerPromise) {
				console.error('[LiteYT] playerPromise never created');
				return;
			}

			// Wait for the promise to resolve
			const ytPlayer = await (liteYoutubeEl as any).playerPromise;

			if (ytPlayer) {
				player = ytPlayer;
				set_player(ytPlayer);
				player_ready = true;

				// Trigger fetch_source event after player is ready
				if (mode.includes('study')) {
					state_study_player_fsm.send('fetch_source');
				} else {
					break_study_player_fsm.send('fetch_source');
				}
			}
		} catch (error) {
			console.error('[LiteYT] Failed to setup after manual activation:', error);
		}
	}

// Handle manual activation (when user clicks the video thumbnail directly) async function handleManualActivation(event: Event) { if (activated) return; // Let the lite-youtube component's own click handler run first await new Promise((resolve) => setTimeout(resolve, 0)); activated = true; // Poll for playerPromise to be set, then wait for it to resolve try { // Poll for playerPromise to exist (set by addYTPlayerIframe) let attempts = 0; const maxAttempts = 50; // 5 seconds max while (attempts < maxAttempts && !(liteYoutubeEl as any).playerPromise) { await new Promise((resolve) => setTimeout(resolve, 100)); attempts++; } if (!(liteYoutubeEl as any).playerPromise) { console.error('[LiteYT] playerPromise never created'); return; } // Wait for the promise to resolve const ytPlayer = await (liteYoutubeEl as any).playerPromise; if (ytPlayer) { player = ytPlayer; set_player(ytPlayer); player_ready = true; // Trigger fetch_source event after player is ready if (mode.includes('study')) { state_study_player_fsm.send('fetch_source'); } else { break_study_player_fsm.send('fetch_source'); } } } catch (error) { console.error('[LiteYT] Failed to setup after manual activation:', error); } }

This is a piece of code written by Sonnet 4.5 in my actual app 😄

We needed onclick={activate()}

Instead we got a polling system filled with as anys lol.

This is with Playwright mcp, svelte 5 mcp, ultrathink, telling it my grandma was in danger if it did it wrong; this is the outcome lol.

3 months ago 2 0 1 0

At this point I can't use Svelte without Runed 😅🧡

3 months ago 4 0 0 0

It seems like Cloudflare Workers are much cheaper than Vercel for hosting something like a SvelteKit app.

Am I missing something?
- Vercel is $20/m for 10m requests
- Workers are $5/m for 10m request, not including static assets.

3 months ago 2 0 0 0
Tomatillo Timer Traffic

Tomatillo Timer Traffic

Tomatillo Timer Data Transfer

Tomatillo Timer Data Transfer

Cleaned up some initial load performance issues on one of my side projects. Thought these two charts were pretty interesting in retrospective.

Light chart is traffic, dark chart is data transfer. - Even though traffic kept increasing, data transfer dropped from 13GB to 500MB.

timer.flotes.app

3 months ago 1 0 0 0

Concrete example:

Learning cryptography by making a little CLI that can encrypt/decrypt stuff can feel quickly rewarding.

Compared to making a note-taking application that uses E2EE, where you might spend half your time lost in the details of the note-taking app, and not learning cryptography.

3 months ago 1 0 1 0

Some ideas that might possibly help :)

If it's learning through application. Go small but mighty.
- A plugin to an app/editor can do a lot with a little code.
- A CLI lets you focus on the core and not how it looks.
- A small library can solve sub problems in big apps.

3 months ago 1 0 1 0

Also, if you're using LazyVim, which is a great distribution and very well done. IMO use LazyExtras judiciously. They might get you where you want quickly, but they also might:
- Do things you didn't realize/expect
- Break when you update

Extras have great docs, if anything just use as a reference.

3 months ago 1 0 0 0
Preview
nvim-lspconfig/lsp at master · neovim/nvim-lspconfig Quickstart configs for Nvim LSP. Contribute to neovim/nvim-lspconfig development by creating an account on GitHub.

The setup is very intuitive

Create a folder /after/lsp/ in your run time path.

Start with a copy paste of the language server you want from here: github.com/neovim/nvim-...

call vim.lsp.enable('your_language_server_name') on startup

go to a filetype for that ls, run: checkhealth vim.lsp ✅

3 months ago 2 0 1 0

vim.lsp.config has fixed so many issues I've been having in Neovim.
- Svelte LS crashes on large svelte projects
- Autocomplete suggestions are duplicated
- ts_ls doesn't attach to .ts buffers at all
- svelte files don't recognize changes to ts files

3 months ago 1 0 1 0
Advertisement

Using lite-youtube made up for a really big portion of the reduction. Some kind of interesting techniques. Minifying my wav files with ffmpeg into mp3s. Extracting subsets of fonts to only the characters I need (Tomatillo Timer / 123456789:). And a lotttt of lazy loading components.

3 months ago 1 0 0 0
Post image

Not perfect, but reduced the resources loaded on start by one of my svelte apps from 12.4MB to 1.5MB. Something like an 88% reduction in size.

timer.flotes.app

3 months ago 1 0 1 0

For example, if I said "Don't use Svelte".

So many questions.
- Why not?
- What should I use instead?
- When is it okay to use?

Most of the time we say "Don't do X", but don't provide alternatives, exceptions, why, etc... I think it creates more confusion than clarity.

3 months ago 5 0 1 0

Agreed with read the docs haha. And I think the people saying it generally have good intention / are using it to mean, think twice, like you mentioned.

Buuut I don't think it comes off that way to many readers 😅.

3 months ago 2 0 1 0

"Don't use effects, use events or function bindings whenever possible" is imo a great answer and supported by the docs. :)

"Don't use effects" is a frequently repeated and upvoted statement that provides no alternative. - Exhibit A, it took 2 months for this post to get a reply lol

3 months ago 5 0 1 0

I'm using Neovim & Copilot CLI. How do others run multiple agents at a time?

Any attempt to run more than 1 and they both start running npm run dev and playwright against each other in an infinite loop. I can even say "Don't use the default port", no luck lol.

3 months ago 0 0 0 0

The prison arc in season 1 had me absolutely hooked. The rest of the show was pretty good as well 😅!

3 months ago 0 0 0 0

Top of my todolist this morning before work was to *finally* get around to installing umami analytics in one of my side-projects. Saw your earlier post and pivoted 🤣

3 months ago 1 0 1 0

Yeah I'm using LazyVim. I had my own config from following Chris@Machine videos like 5ish years ago. Then switched to LazyVim 1-2 years ago mostly due to issues in really big files and monorepos at work.

Definitely looking to switch back to a custom setup when I get the chance!

4 months ago 2 0 0 0
Advertisement

I probably just need to go through and update all my deps / plugins / etc... and then copy someone else's svelte setup. See where that lands me and adjust from there.

4 months ago 2 0 1 0

NVIM v0.11.3
Svelte-Language-Server 0.17.19

I'm also using LazyVim with the Svelte LazyExtra. This is actually a whole other issue. Without it, changing TS files does not reflect changes in Svelte files. With it, big svelte projects crash the ls. 😭

My svelte lsp setup: github.com/Everduin94/d...

4 months ago 2 0 1 0

On a positive note, if I ever had the time to do a big overhaul, kickstart.nvim looks really appealing.

Too many ideas, not enough time 😅

4 months ago 0 0 0 0

I use a lazy lock file for plugins, and mason for dependencies. Really not sure past that how to keep my config stable. A lot of the time it feels like whack-a-mole. Update a config/plugin/dep/version to fix one thing, another thing unknowingly breaks.

4 months ago 0 0 1 0

I'm having a bunch of little issues pop up in my Neovim lately.
- Svelte: I constantly have to restart the LSP for various reasons. Indentation stops working, duplicated references in auto complete, svelte/kit types aren't recognized.
- Ghost text for things like copilot.lua break auto pairs.

4 months ago 4 0 3 0

I'm looking for my next opportunity in the front-end space 🌐

I've worked at some great companies: Hugging Face, V7, Appwrite, and Significa.

I've built NPM packages with 400k downloads/week, and am an avid open-source contributor.

Let me know if you want to work together!

4 months ago 39 20 3 1
Post image

"Property '"~standard"' is missing in type 'ObjectSchema'

For anyone else that runs into a valid schema and svelte kit remote function failing with this error:

My valibot version was old 🥲.

May you save 30 minutes of your life not diddling your config and running :LspRestart 🫡

4 months ago 3 0 0 0

Thanks for the link!

I definitely don't some stuff you have like didChangeWatchedFiles = false in my config

I will give that a try when I get the chance!

4 months ago 3 0 0 0
Advertisement
  LazyVim.lsp.on_attach(function(client)
    vim.api.nvim_create_autocmd("BufWritePost", {
      pattern = { "*.js", "*.ts" },
      callback = function(ctx)
        client:notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
      end,
    })
  end)

LazyVim.lsp.on_attach(function(client) vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "*.js", "*.ts" }, callback = function(ctx) client:notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) end, }) end)

This is the fix for me.

client:notify instead of client.notify

So confusing 🫤. - There are examples of this workaround everywhere. They all use client.notify. Only example I've seen using client:notify was a Neovim 12 user, I'm on 11.

4 months ago 2 0 0 0
  LazyVim.lsp.on_attach(function(client)
    vim.api.nvim_create_autocmd("BufWritePost", {
      pattern = { "*.js", "*.ts" },
      callback = function(ctx)
        client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
      end,
    })
  end)

LazyVim.lsp.on_attach(function(client) vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "*.js", "*.ts" }, callback = function(ctx) client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) end, }) end)

Outside of the Svelte LazyVim Extra, this used to work for me, but that's no longer the case.

For context I'm on Neovim v0.11.3

4 months ago 0 0 0 0

Anyone using Svelte + Neovim want to share their dots / config? 🙂

I've been using both for a long time, but recently the LazyVim extra for Svelte crashes the svelte-language-server on big svelte projects.

I can't get ts file changes to show in svelte files without LspRestart. 🥲

4 months ago 0 0 4 0

Also just wanted to add, I'm really enjoying using FSM, thanks for your effort on it! - This isn't so much a request as it is just me thinking out-loud 😅. I could copy FSM, try to add context myself, and see if it makes sense. Or maybe I'm just complicating things for the sake of consistency 😆

5 months ago 1 0 1 0