belst
belst
SSolidJS
Created by belst on 5/31/2024 in #support
Modify dev server port
I am working remotely and I keep getting this error during development: can’t establish a connection to the server at ws://localhost:35999/_build/. Can I somehow fix the port so I can forward it correctly?
14 replies
SSolidJS
Created by belst on 3/5/2024 in #support
Vite internal server error expected "}" but found end of file
No description
5 replies
SSolidJS
Created by belst on 10/22/2023 in #support
hmr and WebSockets
hi, when trying to use websockets during development, it can take up to 20 seconds for the socket to connect after an hmr reload. Can I somehow not try to keep the websocket state during hmr and just reconnect?
7 replies
SSolidJS
Created by belst on 7/30/2023 in #support
Avoiding rerenders using `setState + reconcile`
Hi, Currently I have a webworker producing data slices which I want to render. It looks a bit like this:
// limit frontend updates to max 100 per second or min 1 per second
const timer;
const lastUpdate = Date.now();
worker.onmessage = ({data}) => {
clearTimeout(timer);
const now = Date.now();
const update = () => {
lastUpdate = now;
setState('events', reconcile(data.evts));
};
if (now > lastUpdate + 1000) {
update();
} else {
setTimeout(update, 10);
}
};
// limit frontend updates to max 100 per second or min 1 per second
const timer;
const lastUpdate = Date.now();
worker.onmessage = ({data}) => {
clearTimeout(timer);
const now = Date.now();
const update = () => {
lastUpdate = now;
setState('events', reconcile(data.evts));
};
if (now > lastUpdate + 1000) {
update();
} else {
setTimeout(update, 10);
}
};
The problem is, when I have a <For each={state.events}> somewhere, the whole loop keeps rerendering, even if only a few elements have been prepended (they always get prepended). I thought of trying to specify the key in reconcile (the data itself doesn't change, just position in the array) but it is 2 levels deep. The events array is of type:
type EventDataFoo = {timestamp: Date, some_other_data: any};
type EventDataBar = {timestamp: Date, some_data: any};
type Events = ({kind: 'foo', data: EventDataFoo} | {kind: 'bar', data: EventDataBar})[]
type EventDataFoo = {timestamp: Date, some_other_data: any};
type EventDataBar = {timestamp: Date, some_data: any};
type Events = ({kind: 'foo', data: EventDataFoo} | {kind: 'bar', data: EventDataBar})[]
the key would be data.timestamp which is guaranteed to be unique, even over different data kinds. reconcile expects the key to be a string tho which I can only provide for 1 level. Am I misunderstanding something completely or is this really hard to achieve?
21 replies
SSolidJS
Created by belst on 7/25/2023 in #support
TypeError: Cannot read properties of undefined (reading 'remove') at reconcileArrays
I get this during a refetch() call of a resource. Pretty hard to debug and see what actually gets called where and so on. gets cought and rethrown in runComputation
3 replies