Develliot
TTCTheo's Typesafe Cult
•Created by Blankeos on 11/14/2023 in #questions
Copilot account question
I always use my personal GitHub account at work. If they want to boot me off repos when I leave then they have the ability to do that. I get to keep my comit history for public repos.
I think its possible to have a Vs code extension signed into one account and your separate command line tool using another.
The contention is that co pilot on an enterprise GitHub licence doesn't send any code snippets outside of your org and I think co pilot personnel does. If the org has an infosec department they might lose their shit about that.
7 replies
TTCTheo's Typesafe Cult
•Created by Xanacas on 11/5/2023 in #questions
How to get rid of this unnecessary code while preventing eslint from complaining.
In React land we often go out of our way to avoid doing things with side effects and create new arrays rather than mutate the thing we are iterating over.
6 replies
TTCTheo's Typesafe Cult
•Created by Xanacas on 11/5/2023 in #questions
How to get rid of this unnecessary code while preventing eslint from complaining.
Since find() exists I rarely use findIndex()
6 replies
TTCTheo's Typesafe Cult
•Created by Xanacas on 11/5/2023 in #questions
How to get rid of this unnecessary code while preventing eslint from complaining.
If you are looking through a small array and returning another small array with changes you are probably better off using .map(). It's less memory efficient but has fewer side effects and removes the possibly undefined errors because you are creating as you loop through.
6 replies
TTCTheo's Typesafe Cult
•Created by Daniel K on 5/14/2023 in #questions
SVGR doesn't display colors from my SVG
Check in a browser I bet when you inspect the SVG the IDs are all different.
6 replies
TTCTheo's Typesafe Cult
•Created by Daniel K on 5/14/2023 in #questions
SVGR doesn't display colors from my SVG
Svgo can mess with IDs so if there is CSS inside the SVG that is dependent on the IDs it will break. You have 2 options. 1) Svgo config in the webpack config, make sure it doesn't change/namespace IDs. 2) don't make it an inline SVG load it into the src of an img element. Not sure if this will run into the same problem tbh but worth a try.
6 replies
TTCTheo's Typesafe Cult
•Created by Jaaneek on 4/12/2023 in #questions
What do you use for carousels?
I built my own because snap to scroll is now a thing it was fairly straightforward. I even had a dot counter thing that you could click on and it would jump to position as well as side scrolling it used an intersectional observer to figure out what was in view. Some nice transition animations and boom. The only hack was to get rid of the scroll bar on iOS Safari
12 replies
TTCTheo's Typesafe Cult
•Created by mid on 4/3/2023 in #questions
Forward Ref with SVG
Could put ref on a wrapping div or is that cheating?
2 replies
TTCTheo's Typesafe Cult
•Created by pandakas on 3/13/2023 in #questions
Modal in a list
I would go even further instead of having a delete button appear billion times in a row I would have a way of selecting one or many and have a contextual tool bar at the top with actions where you can delete multiple at a time.
Having lots of the the same button with the same text technically do something different or that goes somewhere different is bad accessibility unless you have custom aria labels being explicit to make a distinction between each button.
11 replies
TTCTheo's Typesafe Cult
•Created by Basilisk on 2/24/2023 in #questions
React Query - Slow performance with many small cached requests
You can use next config for a permanent redirect for anything /images/....blah.png to point at the cloudfront for the S3 bucket
10 replies
TTCTheo's Typesafe Cult
•Created by Basilisk on 2/24/2023 in #questions
React Query - Slow performance with many small cached requests
I would have 2 image services a prod one that you care about and a dev/Integration one that you don't lax permissions etc and develop with the non prod one so just use env vars to know which one is which all you need is a place to dump the file and an returned URL S3 storage is cheap you could leave stuff there forever. Then you can keep your API res data trim and slim.
10 replies
TTCTheo's Typesafe Cult
•Created by Basilisk on 2/24/2023 in #questions
React Query - Slow performance with many small cached requests
If you used URLs to images and the images live on a CDN so the browser can load and cache them separately. I wouldn't encode images into base64 strings in an API call for react query to cache.
10 replies
TTCTheo's Typesafe Cult
•Created by Aman on 2/8/2023 in #questions
Best Approach for error handling
Let users know they need to fix something as soon as possible not 3 pages later
11 replies
TTCTheo's Typesafe Cult
•Created by Aman on 2/8/2023 in #questions
Best Approach for error handling
Form validation messages aren't strictly speaking JS errors.
Field by field, validate on field blur, not on change. Always validate on blur because if you set the aria alert stuff you don't want screen readers screaming errors on every key stroke
11 replies
TTCTheo's Typesafe Cult
•Created by Aman on 2/8/2023 in #questions
Best Approach for error handling
I should clarify you might be doing 2-3 things in the code which could throw an error and only 1 of them the user cares about. It's not the user doing 1 or more things.
11 replies
TTCTheo's Typesafe Cult
•Created by Aman on 2/8/2023 in #questions
Best Approach for error handling
May be I'm not up to date with the latest way of using error boundaries, onCaughtError or whatever it's called only works on old class style components so I only ever used it top level. But if that ever catches something it means there is a promise without a catch or something else that I probably should fix.
11 replies
TTCTheo's Typesafe Cult
•Created by Aman on 2/8/2023 in #questions
Best Approach for error handling
You do different things in different scenarios, so form success would redirect the user or show a success toast message and the failure would show an error message as close to the problem as possible, so if it was a submission error right next to the submit button, if it was a validation issue right next to the input with the issue and scroll the user to the problem.
11 replies