Quantcast
Channel: User HMR - Stack Overflow
Browsing all 43 articles
Browse latest View live
↧

express not executing error handling middleware

This is the server:app.use(authMiddleware)app.use(express.json())app.use(CUSTOMERS, customerRouter)app.use(handleError)function startServer() {So handle error is the last middleware, this is the route...

View Article


Answer by HMR for express not executing error handling middleware

In validateUser I am calling next twice: const errors = validate(request.body) errors.length ? next(new HttpError(400, 'Invalid user sent', errors)) : next() next()//do not need this oneRemoving that...

View Article


Answer by HMR for Is React-Redux still useful as of 2023?

If you have a global useContext and/or/with useReducer then all components using that context will re render no matter if the part of the sate they use has changed or not, if you also have a handler...

View Article

Answer by HMR for Can someone explain how input functions are used in...

I think more important to how reselect works is why one should use it. The main reasons are composability and memoization:ComposabilityAnother way of saying this is that you write a selector once and...

View Article

Answer by HMR for For what purpose useSelector() and reselect...

You cannot always pass values to a component from its parent because the parent doesn't logically own the value (shared state) or because there are many component in between the component that has the...

View Article


React MUI TreeView key navigation broken when using a Branch component

When I do the following I can navigate with my arrow keys through the tree and the tree gets focus when I tab through the document (only root items, sub branches are broken because they use...

View Article

Get the last modification date of a file in git repo

I'm trying to find a command to get the last modified date of a file in a local git repo.I have created the repo and done one commit. I only had to edit one file and will commit it, but I was wondering...

View Article

Answer by HMR for Is there a performance penalty when using closures to...

selectOrdersByCustomer(customerId) Creates a new function every time it is called but still does not need to be a problem if you have a pure component that only re renders when customerId changes:const...

View Article


i18n currency produces many warnings

I have the following warning in my vue 3 app:[intlify] Not found 'currency' key in 'US' locale messages.[intlify] Fall back to number format 'currency' key with 'en-US' locale[intlify] Fall back to...

View Article


Answer by HMR for trpc error Input parser must be a ZodObject

I found that trpc-opeapi uses zod-to-json-schema and zod-to-json-schema does not support union. Hence trpc-openapi does not support OpenAPI 3 spec.

View Article

trpc error Input parser must be a ZodObject

I have the following input schema:const inputSchema = z.union([ z.object({ id: z.string(), }), z.object({ key: z.string(), }),])This schema works until I do:import { generateOpenApiDocument } from...

View Article

Answer by HMR for Jest ReferenceError: Request is not defined

Jest has an outdated jsdom config because it uses outdated jsdom.I applied the sollution here and it works as long as I add the ts file in the jest config as testEnvironment but won't if I want to use...

View Article

Prevent Y scrollbar on parent and adding scrollbar to child

I have a parent that is used as a React component and has a scrollbar, I cannot change the parent but in a certain case I'd like the parent not to display the scrollbar and instead have the child...

View Article


Mongoose auto increment

According to this mongodb article it is possible to auto increment a field and I would like the use the counters collection way.The problem with that example is that I don't have thousands of people...

View Article

Next.js getServerSideProps show loading

I am using getServerSideProps in pages/post/index.js:import React from "react";import Layout from "../../components/Layout";function Post({ post }) { console.log("in render", post); return (<Layout...

View Article


How to change indentation in Visual Studio Code?

For every typescript file visual studio code uses an auto indentation of 8 spaces. This is a bit too much for my taste but I can't find where to change it.Maybe it's available as a setting but under a...

View Article

Docker container, how to use host proxy

Because I'm in China it is nearly impossible to use Docker Hub, Git, GitHub, npm and loads of other tools without a VPN.I finally found how to have the Docker daemon use a proxy (share VPN in the VPN...

View Article


Vue i18n sometimes warn about missing key

In my home component I have the following:const { location } = useLocation();const { t, n } = useI18n();const freeShippingValue = computed(() => { return n(100, 'currency', location.value);});In my...

View Article

How to get the last modification date of a file in a git repo?

I'm trying to find a command to get the last modified date of a file in a local git repo.I have created the repo and done one commit. I only had to edit one file and will commit it, but I was wondering...

View Article

vscode format not formatting

I installed prettier plugin for vscode and have a .pretteirrc.js:module.exports = { trailingComma: 'es5', tabWidth: 2, semi: true, singleQuote: true, printWidth: 60,}In settings the default formatter...

View Article
Browsing all 43 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>