danboyle8637
danboyle8637
Explore posts from servers
SSolidJS
Created by danboyle8637 on 3/15/2024 in #support
Render Portal as Error Boundary Fallback?
I want to refactor my async code to use Suspense and Error Boundaries. But when a network request fails... I show an error dialog telling the user what happened and what to do next. This is rendered in a Portal. Can I just stick that component in the fallback of an Error Boundary and have it work the same?
2 replies
SSolidJS
Created by danboyle8637 on 12/29/2023 in #support
Newest Router... Error about missing the wrapper Router component
This is more of a curiosity question for me... I just updated to the newest router. I'm using Solid... not Solid Start... I have an App component that had my routes in it. All of the Route components were wrapped in the Router component and the App component was default exported. In my index.ts file I imported the App component and used it in the render call. But I kept getting an error stating my routes were not wrapped in a Router. Why was this not working? It seems you have to direct render the Router in the render call for the routes to work.
3 replies
SSolidJS
Created by danboyle8637 on 10/15/2023 in #support
Regular Solid - the Correct way to use createResource?
In my app, on my Dashboard view, I am using createResource to get my user data. I'm then just updating another user signal with data returned from the createResource. I'm doing this because this user signal is used through out the app... so when it's populated the correct data is displayed. But this has me thinking... why not just use regular fetch in an onMount to get the data and update the user signal. What is the correct way to use createResource? You don't want to have an "instance" of createResource all over your app do you? That doesn't make sense to me.
5 replies
SSolidJS
Created by danboyle8637 on 3/25/2023 in #support
Catching Errors from async requests started in onMount
There must be a hole in my Solid knowledge. I want to run a fetch request on component mount. This is not fetching any data so I don't want to use createResource This async request is taking state and saving it to the database. However, how do I catch any errors. When the async function throws... the error is always uncaught. Example code:
import { getTestEndpoint } from "../../utils/networkFunctions";

export const TestError = () => {
onMount(() => {
const runAsync = async () => {
await getTestEndpoint();
};

runAsync();
});

return <h1>Test Error</h1>;
};
import { getTestEndpoint } from "../../utils/networkFunctions";

export const TestError = () => {
onMount(() => {
const runAsync = async () => {
await getTestEndpoint();
};

runAsync();
});

return <h1>Test Error</h1>;
};
The test endpoint purposely returns a 500 status code which then throws an error. But I can't catch this error with an ErrorBoundary... can't catch it with try/catch What am I missing?
4 replies