For low computational work should I do it on server or client ?

It probably won't make a difference at low scale. So I probably shouldn't worry too much about this but still. Here is an example to make my question clearer. I want to implement a translated input on my client. I implement a list of dynamic inputs on the client, each row is an object containing the language and the value (2 inputs per row). So client side data is an array of object like this:
type Skill = {
...
description: {value: string; language: string}[]
}
type Skill = {
...
description: {value: string; language: string}[]
}
On DB side I want this array to be a JSON object with the language as key and value as... value.
type Skill = {
...
description: {[language:string]: string}
}
type Skill = {
...
description: {[language:string]: string}
}
Should I format the object on the client and then send it formatted to the server. Or should I send the array unformatted to the server and then transform it server side before writing it to DB ? I guess using client ressources as much as possible makes more sense financialy. Apart from obvious security/critical reasons. When would you guys stop using client ressources to use server instead ?
2 Replies
Matvey
Matvey•2y ago
I think things like page translations should be handled on a server. You shouldn't send any unnecessary data to the client as it slows down the first render
Glorrin
Glorrin•2y ago
It is the other way around, it is a form where the user can translate his own fields if he wants to, I could translate them for him but sometimes user want to change the wording depending on language. But your comment is great, for another page, thanks 🙂
Want results from more Discord servers?
Add your server