Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

a hot gujju bhabhi posted:

Why are there no logs? How do you look at historical events?

if this is still that stock ticker project, if there's a problem, he'll see it on TV.

Adbot
ADBOT LOVES YOU

MrMoo
Sep 14, 2000

a hot gujju bhabhi posted:

Why are there no logs? How do you look at historical events?

Usually via Chinese whispers. It's character building or something like that. In reality there are only a finite number of events and usually you will see the same problem happen again on another day that you can run in parallel with a system that has logging or a debugger attached.

This isn't a NYSE project although they have asked about using similar TVs before, these are incredibly underpowered devices:

Samsung posted:

Expected performance

2017 Premium TV: 30~33fps
2016 Premium TV: 8~9fps

The NYSE devices run 1080p at 60fps, with 12 monitors hanging off a single PC. I have a dev server running in parallel so I can sometimes track issues live, but yes live streaming on TV helps.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

MrMoo posted:

Making a webapp with no logs, no log server, and no window scrolling or pretty much any useful input device, what to do with fatal errors?



I stick an ErrorStackTrace into the QR code that you can easily look at with an iPhone.

I pinched the HTML/CSS from a Codepen, although that is a bit broken. QR Code from kjua.

😜

“1 seconds” oof.

MrMoo
Sep 14, 2000

💩 I'll credit you in the commit log.

darthbob88
Oct 13, 2011

YOSPOS
Webpack problem: For some strange reason, Webpack isn't outputting any files for me. All file paths are correct as far as I can tell, MyStyles.less is listed as a dependency in main.ts, and it only began having these issues when I tried adding the LESS handling. How should I proceed from here, what should I look for to debug this?

E: Dammit, I forgot at the time, and don't entirely remember now. IIRC, the issue was that the output path defaulted to "/dist"; files were being output, but not in the right place. I added "path: __dirname" to output and everything worked after that.
webpack.config.js -
code:
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
    entry: "./Scripts/app/main.ts",
    output: {
        filename: "./Scripts/app/compiled_app.js"
    },
    devtool: "source-map",
    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
    },

    optimization: {
        splitChunks: {
            cacheGroups: {
                styles: {
                    name: 'styles',
                    test: /\.css$/,
                    chunks: 'all',
                    enforce: true
                }
            }
        }
    },
    plugins: [
        new MiniCssExtractPlugin({
            filename: "./Content/MyStyles.css",
        })
    ],
    module: {
        rules: [
            {
                test: /\.ts$/,
                exclude: ['node_modules'],
                use: [{ loader: 'ts-loader' }]
            },
            {
                test: /\.less$/,
                use: [
		    "style-loader",
                    "css-loader",
                    "less-loader"]
            }
        ]
    }
};
output:
code:
> cmd /c SET NODE_ENV=development&& webpack --color --display-error-details
Hash: 2512347b752d2e0fb0d5
Version: webpack 4.12.0
Time: 28372ms
Built at: 06/15/2018 4:12:22 PM
                            Asset      Size  Chunks                    Chunk Names
    ./Scripts/app/compiled_app.js  1.26 MiB       0  [emitted]  [big]  main
./Scripts/app/compiled_app.js.map  5.92 MiB       0  [emitted]         main
 [44] ./node_modules/ngx-modal-dialog/index.js + 5 modules 16.3 KiB {0} [built]
      |    6 modules
 [45] ./Scripts/app/services/telemetry-service.ts 3.11 KiB {0} [built]
 [61] ./Scripts/app/controllers/feedback-controller.ts 9.63 KiB {0} [built]
 [62] ./Scripts/app/controllers/static-controller.ts 2.01 KiB {0} [built]
 [63] ./Scripts/app/services/notification-service.ts 1.06 KiB {0} [built]
 [86] ./Scripts/app/controllers/landing-controller.ts 18.3 KiB {0} [built]
 [88] ./Scripts/app/controllers/scenario-controller.ts 30.6 KiB {0} [built]
[190] ./node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js + 1 modules 1.18 MiB {0} [built]
      |    2 modules
[191] ./Scripts/app/controllers/main-controller.ts 4.17 KiB {0} [built]
[192] ./Scripts/app/controllers/404-controller.ts 1.3 KiB {0} [built]
[193] ./Scripts/app/routing.ts 2.17 KiB {0} [built]
[477] ./Scripts/app/app.ts 3.11 KiB {0} [built]
[481] ./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js!./Content/MyStyles.less 43.4 KiB {0} [built]
[482] ./Content/MyStyles.less 1.2 KiB {0} [built]
[486] ./Scripts/app/main.ts 348 bytes {0} [built]
    + 472 hidden modules
WARNING in ./node_modules/@angular/core/esm5/core.js 6570:15-36
Critical dependency: the request of a dependency is an expression
    at <snip for brevity and anonymity>
 @ ./Scripts/app/app.ts
 @ ./Scripts/app/main.ts
WARNING in ./node_modules/@angular/core/esm5/core.js 6590:15-102
Critical dependency: the request of a dependency is an expression
    at ImportContextDependency.getWarnings <snip for anonymity
 @ ./Scripts/app/app.ts
 @ ./Scripts/app/main.ts
WARNING in ./node_modules/@angular/core/esm5/core.js 6570:15-36
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit [url]https://webpack.js.org/guides/code-splitting/[/url]
 @ ./Scripts/app/app.ts 9:13-37
 @ ./Scripts/app/main.ts
WARNING in ./node_modules/@angular/core/esm5/core.js 6590:15-102
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit [url]https://webpack.js.org/guides/code-splitting/[/url]
 @ ./Scripts/app/app.ts 9:13-37
 @ ./Scripts/app/main.ts
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: [url]https://webpack.js.org/concepts/mode/[/url]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  ./Scripts/app/compiled_app.js (1.26 MiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (1.26 MiB)
      ./Scripts/app/compiled_app.js
WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit [url]https://webpack.js.org/guides/code-splitting/[/url]
Process terminated with code 0.

darthbob88 fucked around with this message at 02:39 on Sep 2, 2018

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
I usually try not to use packages for anything unless i’m absolutely desperate, but I’m realized today that I really really really hate sorting things. It makes my brain hurt and it’s the one instance where I have no shame letting a package work it’s magic

Vincent Valentine
Feb 28, 2006

Murdertime

Sometimes it really is best to just admit that you stand in the shoulders of giants, and that they know better.

lunar detritus
May 6, 2009


Dates suck enough that I feel zero guilt at adding a library for dealing with them.

F4rt5
May 20, 2006

Dates and encryption are the two things you really shouldn't do yourself. Both are going to bite you in the rear end down the road, and quite spectacularly annoyingly so.

prom candy
Dec 16, 2005

Only I may dance
Just use packages for most stuff. Someone has probably already solved whatever problem way better than you could have.

lunar detritus
May 6, 2009


JazzmasterCurious posted:

Dates and encryption are the two things you really shouldn't do yourself. Both are going to bite you in the rear end down the road, and quite spectacularly annoyingly so.

I can confirm that bit about encryption. There's some support nowadays but I regret thinking I could use it, all browsers do it differently with different support for different algorithms. It's a mess.

F4rt5
May 20, 2006

prom candy posted:

Just use packages for most stuff. Someone has probably already solved whatever problem way better than you could have.

Yup. It's one thing to write it to get the practice, but there's (almost) always something done already that 20-1000 people have contributed input and fixes to already.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

JazzmasterCurious posted:

Dates and encryption are the two things you really shouldn't do yourself. Both are going to bite you in the rear end down the road, and quite spectacularly annoyingly so.

T I M E Z O N E S

well I guess that's a date/datetime object in many languages

F4rt5
May 20, 2006

TheFluff posted:

T I M E Z O N E S

well I guess that's a date/datetime object in many languages

Yeah timezones and leap anything was my thought. Say what you will about Tom Scott but his rant about timezones is pretty great in projecting the horror of it all.

Tei
Feb 19, 2011

I use to be anti-packages, but after many mistakes I have learn many things are better handled with packages. Dates are already mentioned. Escaping anything or satinifying anything.

If you are going to receive random html from a unknown source, and satinify it. You better use the best tools available and not try to satinify it yourself.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

JazzmasterCurious posted:

Yup. It's one thing to write it to get the practice, but there's (almost) always something done already that 20-1000 people have contributed input and fixes to already.

it's thinking like that which ended up making me a contributor to the SJCL when I was doing my master's project.

5TonsOfFlax
Aug 31, 2001

Tei posted:

I use to be anti-packages, but after many mistakes I have learn many things are better handled with packages. Dates are already mentioned. Escaping anything or satinifying anything.

If you are going to receive random html from a unknown source, and satinify it. You better use the best tools available and not try to satinify it yourself.

What do you mean by satinify, and what package would do that? There are literally 0 relevant Google hits. From context it sounds like a way to make html safe to include in other html.

Edit: did you mean sanitize?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Code modularity and the idea of libraries that code modularity enabled, is among the greatest ideas to ever arise in computer languages.

Use libraries.

porksmash
Sep 30, 2008
Another pro for packages: How else are you going to be a github celebrity if you don't contribute bug fixes to all the broken packages you use?

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Thermopyle posted:

Code modularity and the idea of libraries that code modularity enabled, is among the greatest ideas to ever arise in computer languages.

Use libraries.

actually javascript is unique in how terrible libraries can be, and web developers are particularly terrible at assessing whether or not they are any good because they are (mostly) all fresh out of college, so just because you hear a library name at some meet-up or something, you really can't assume the library is any good at all. i'm not saying that you shouldn't use libraries, you just need to be smart about isolating them from your project. i've spend literally months debugging poo poo in the jquery library for instance - that's months i could've spent on solving problems with business value.

Bruegels Fuckbooks fucked around with this message at 16:49 on Jun 19, 2018

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Bruegels Fuckbooks posted:

actually javascript is unique in how terrible libraries can be, and web developers are particularly terrible at assessing whether or not they are any good because they are (mostly) all fresh out of college, so just because you hear a library name at some meet-up or something, you really can't assume the library is any good at all. i'm not saying that you shouldn't use libraries, you just need to be smart about isolating them from your project. i've spend literally months debugging poo poo in the jquery library for instance - that's months i could've spent on solving problems with business value.

Yeah, so instead of finding a good library, we should let all these terrible web develoeprs develop the functionality from scratch.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Thermopyle posted:

Yeah, so instead of finding a good library, we should let all these terrible web develoeprs develop the functionality from scratch.

it depends on the problem you're trying to solve. like, would i roll my own js crypto library or date library? gently caress no. but it can actually take longer and be a bigger cost to use a library than to just solve the problem yourself. it's not like you're standing on the shoulders of giants with this web development stuff, there's an incredible amount of bs.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Also know when to roll your own rather than hacking around a library that isn't doing what you want. I'm in the process of ditching gl-matrix in my own app because of how... *checks paper* not good it is.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Bruegels Fuckbooks posted:

it depends on the problem you're trying to solve. like, would i roll my own js crypto library or date library? gently caress no. but it can actually take longer and be a bigger cost to use a library than to just solve the problem yourself. it's not like you're standing on the shoulders of giants with this web development stuff, there's an incredible amount of bs.

Yeah, I don't think anyone would say its a good idea to just blindly mash in whatever library to solve whatever problem and drat the consequences.

I'm pushing back against the idea raised earlier in the thread (and which I see with developers in all languages): "I try to avoid libraries".

Doom Mathematic
Sep 2, 2008

Bruegels Fuckbooks posted:

actually javascript is unique in how terrible libraries can be, and web developers are particularly terrible at assessing whether or not they are any good because they are (mostly) all fresh out of college, so just because you hear a library name at some meet-up or something, you really can't assume the library is any good at all. i'm not saying that you shouldn't use libraries, you just need to be smart about isolating them from your project. i've spend literally months debugging poo poo in the jquery library for instance - that's months i could've spent on solving problems with business value.

What went wrong in jQuery?

MrMoo
Sep 14, 2000

Interested here too, jQuery's main problem is that HTML5 provides the same features although slightly prosaic in form, the libraries end up gigantic for all the crud they grew.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Doom Mathematic posted:

What went wrong in jQuery?

Let me talk about jquery event handling.

So like, around the IE6/IE7 days, different browsers had different, incompatible properties in their event handlers. JQuery's approach to fixing this was to 'fix' the event using JQuery.event.fix(), which basically would try to make it so you could use event handlers in a cross-browser way without doing a bunch of bullshit.

Unfortunately:
a) JQuery.event.fix() is loving slow. It uses properties that can trigger browser reflows, and I've seen fix take upwards of 30~40% of cpu time in mousemove handlers just to normalize properties.
b) JQuery.event.fix() is almost completely unnecessary if you don't care about IE8 and before.
c) Rather than just be like 'gently caress this, screw JQuery.event.fix()', the JQuery took the approach of having 'an event handler cache.' What this means is that when you create an event handler in JQuery, it will create the function in the JQuery namespace itself, and have another function point at that function in the JQuery namespace.

The consequences of this are:
a) If you call removeElement on an element that has an event handler in vanilla js, the event handler goes away. If you call removeElement on an element in JQuery, the original function and whatever is bound to it lives in the JQuery event handler cache forever - if you bound this to the function scope, well, your stuff is never going to garbage collect.
b) Moreover, JQuery fucks up all the memory profiling tools because this event handler cache bullshit makes it so instead of the leaked memory being in the namespace of the code that leaked, everything is leaked in the JQuery namespace instead. God help you if you use $.proxy, say goodbye to anything in that function ever releasing the memory again.
c) The JQuery pros will recommend that you use features like 'event delegation' and bullshit to speed up your JQuery, not realizing that vanilla js event handlers are fast, idiot proof, and don't leak - you don't have to use event delegation in vanilla js because just attaching the event handler to every element that would trigger the event would perform better!

Like, in 2006-2008 timeframe, I remember that people still used IE6 and IE7, so all this bullshit made sense. In 2018, all JQuery event handling does is make the setting 'break on every exception' super annoying because it throws exceptions in expected program flow.

Similarly, sizzle (the jquery selector engine) is worse than just doing querySelectorAll in anything later than IE9. God I remember spending like three weeks balls deep in that library because of some bullshit involving iframe and unload event handlers.

(I am actually a contributor to this library, but in my defense I was new when I had these problems.)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



:allears: oh man it must have been nice not having to care about IE<9 after 2008.

Yeah, making a SPA with just jQ would be pretty tedious, but that's not really its wheelhouse. It's great at progressive enhancement, though of course that's out of vogue.

prom candy
Dec 16, 2005

Only I may dance
I just want to say I'm loving GraphQL and Apollo and you should check it out if you haven't. I've gotten rid of so much redux data fetching and normalization code. I might even get rid of redux completely in this project because I'm down to like one or two reducers and maybe 4 actions total. I say this as someone that worships at the altar of Abramov.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

prom candy posted:

I just want to say I'm loving GraphQL and Apollo and you should check it out if you haven't. I've gotten rid of so much redux data fetching and normalization code. I might even get rid of redux completely in this project because I'm down to like one or two reducers and maybe 4 actions total. I say this as someone that worships at the altar of Abramov.

Abramov's First Commandment: "You might not need Redux"

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!
Well I looked through the router code sample from angular.io and it seems like every component has its own routing module?

I feel like my next step is stopping work on the project and quitting the company because clearly I'm a loving moron.

I'm just trying to get a JSON object from a third party given a request with some optional parameters. These optional parameters are in the URL (e.g. ?q=what&n=60&p=2)
The result would feed into a number of components.
I first thought I would have each component do the request, but that resulted in multiple requests.
So then I decided to have a parent component do the request and just pass the result to the child via @Input()
The children, via user interaction (click) can add/edit the optional parameters. This action updates the URL, but the parameters in the URL are unfortunately not a 1:1 match to the parameters in the request.

I did have it sort of working, but the initial load didn't read the URL parameters correctly ({{value | async}}, how helpful, can I have just the value without the async so I can transform it into a value to pass to the third party????).
Also the back button didn't work, well it changed the URL, but not the content, probably because I wasn't using [routerLink] and/or [queryParams] on the aforementioned click actions.



I hate how this thread is a constant reminder to me that I'll never be good enough, and the moment I get somewhat of a grasp on anything, it's immediately deprecated and all the knowledge gained is useless. Case in point, all the research showing params and queryParams which have been deprecated in favor of paramMap and queryParamMap respectively.

HaB
Jan 5, 2001

What are the odds?

The Merkinman posted:

Well I looked through the router code sample from angular.io and it seems like every component has its own routing module?

I feel like my next step is stopping work on the project and quitting the company because clearly I'm a loving moron.

I'm just trying to get a JSON object from a third party given a request with some optional parameters. These optional parameters are in the URL (e.g. ?q=what&n=60&p=2)
The result would feed into a number of components.
I first thought I would have each component do the request, but that resulted in multiple requests.
So then I decided to have a parent component do the request and just pass the result to the child via @Input()
The children, via user interaction (click) can add/edit the optional parameters. This action updates the URL, but the parameters in the URL are unfortunately not a 1:1 match to the parameters in the request.

I did have it sort of working, but the initial load didn't read the URL parameters correctly ({{value | async}}, how helpful, can I have just the value without the async so I can transform it into a value to pass to the third party????).
Also the back button didn't work, well it changed the URL, but not the content, probably because I wasn't using [routerLink] and/or [queryParams] on the aforementioned click actions.



I hate how this thread is a constant reminder to me that I'll never be good enough, and the moment I get somewhat of a grasp on anything, it's immediately deprecated and all the knowledge gained is useless. Case in point, all the research showing params and queryParams which have been deprecated in favor of paramMap and queryParamMap respectively.

It doesn’t sound like you are far off. Some questions:

Do the child components each have their own params for making the call? Or if one changes, they all change?

Why do you think multiple requests is bad? How large is the data being returned? How often is it being called?

Think about something like a typeahead textbox tied to the backend. That’s going to be make multiple requests per second as a user types, depending on what the debounce time is set too. But the data set is small so it doesn’t matter.

Basically, if your 3 child components are getting different data, put the call in a common service they can all inject and let each one call it as params change.

If the returned data is large (and “large” here is dependent on your environment and your application), then rethink the problem a bit. Can you return the data in chunks instead of all at once? Can it be paged, etc.

If they are all getting the same data then injecting the service into the parent and passing it down via @Input is probably the way to go, but that also assumes if on child updates, they all do. In that case, have the parent listen for an Event which the children Emit to update the data.

As for you last paragraph- don’t get discouraged. Everyone here, no matter how many years of experience they have STILL has moments of “what the hell I can’t make anything work”. It comes with the job. There’s no ONE solution to any given problem. Just remember it’s code- it can always be refactored later if need be.

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!

HaB posted:

It doesn’t sound like you are far off. Some questions:

Do the child components each have their own params for making the call? Or if one changes, they all change?
If one change, they all (could) change. All the child components are reading the same response, just looking at different parts of it.

HaB posted:

Why do you think multiple requests is bad? How large is the data being returned? How often is it being called?

Think about something like a typeahead textbox tied to the backend. That’s going to be make multiple requests per second as a user types, depending on what the debounce time is set too. But the data set is small so it doesn’t matter.

Basically, if your 3 child components are getting different data, put the call in a common service they can all inject and let each one call it as params change.
Admittingly back-end is not my thing, I just figured fewer requests would be better for performance.

HaB posted:

If the returned data is large (and “large” here is dependent on your environment and your application), then rethink the problem a bit. Can you return the data in chunks instead of all at once? Can it be paged, etc.
It's already 'paged', so I guess it's not that big?

HaB posted:

If they are all getting the same data then injecting the service into the parent and passing it down via @Input is probably the way to go, but that also assumes if on child updates, they all do. In that case, have the parent listen for an Event which the children Emit to update the data.
That's what I did in my rewrite.
parent.component.html
code:
      <app-child [response]="allItems"></app-child>
      <app-other-child [response]="pagination" (changeRequest)="updateRequest($event)"></app-other-child>
other-child.component.html
code:
<a (click)="previousPage()">previous page</a>
other-child.component.ts
code:
  previousPage() {
    this.currentPage = this.currentPage - 1;
    this.changeRequest.emit({'STARTAT': (this.currentPage - 1) * this.itemsPerPage});
  }
changeRequest is an object of the parameter(s) to change. updateRequest takes those parameters, and any previous ones and gets the new data and then does this.router.navigate with the stuff in changeRequest translated to the URL equivalent. This is because the key/values sent to the third party for the JSON are different than the key/values put into the users URL.

HaB posted:

As for you last paragraph- don’t get discouraged. Everyone here, no matter how many years of experience they have STILL has moments of “what the hell I can’t make anything work”. It comes with the job. There’s no ONE solution to any given problem. Just remember it’s code- it can always be refactored later if need be.
Thanks, sometimes here I just feel like the person with one eye in the land of the blind. That's totally on me though, not everyone here. Also it feels like I don't know if I'll ever have time to refactor it, though that's more a problem with the company culture.

Vincent Valentine
Feb 28, 2006

Murdertime

prom candy posted:

I just want to say I'm loving GraphQL and Apollo and you should check it out if you haven't. I've gotten rid of so much redux data fetching and normalization code. I might even get rid of redux completely in this project because I'm down to like one or two reducers and maybe 4 actions total. I say this as someone that worships at the altar of Abramov.

Big Same ™. We still see redux at work, but all my personal projects are in Apollo graphql.

The one and only downside to apollo+graphql is that both are still in their infancy. I've had to fix two bugs in Apollo client so far, while I don't think I ever had to fix one in redux.

Both of those bugs were not just fixed in later versions, but massively improved, so both really were examples of just immature code.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

One reason redux is pretty bug free is its very simple.

The innovation of redux is 85% a way of thinking and structuring your project and 15% the actual library.

M31
Jun 12, 2012

Thermopyle posted:

The innovation of redux is 85% a way of thinking and structuring your project and 15% the actual library.
I feel this is a good summary on why using Redux on a project with mainly junior developers was a mistake.

prom candy
Dec 16, 2005

Only I may dance

Vincent Valentine posted:

Big Same ™. We still see redux at work, but all my personal projects are in Apollo graphql.

The one and only downside to apollo+graphql is that both are still in their infancy. I've had to fix two bugs in Apollo client so far, while I don't think I ever had to fix one in redux.

Both of those bugs were not just fixed in later versions, but massively improved, so both really were examples of just immature code.

Agreed yeah, one of the biggest open and unsolved issues right now is basically "what's the best way to handle mutations that delete something?" What were the bugs that you fixed?

Vincent Valentine
Feb 28, 2006

Murdertime

prom candy posted:

Agreed yeah, one of the biggest open and unsolved issues right now is basically "what's the best way to handle mutations that delete something?" What were the bugs that you fixed?

At one point earlier in its existence(much before apollo2.0), you could set how it would retrieve data. For example you could set it to "cache-only" to only fetch from the cache and ignore the network. Similarly, you could do "network-only" to always get the most fresh data, which had the side effect of not having optimistic updating. I was trying to come up with a system for using client-side state by seeding the cache with some default values, then only call the cache and ignore the network(since there'd be nothing in the network). Instead, it just didn't work at all. I spent awhile toying with things, trying to come up with a solution and then finally decided to dig through the framework code and see what was up. Basically what was there was just early-draft test code that I honestly think was never intended to get released, but iirc it was never actually fixed until 2.0. Hilariously one of the code blocks was, almost verbatim:

code:
if(fetchMethod === "cache-only") {
	fetchMethod = "cache-then-network";
}
Which completely invalidated everything I was doing.

The second bug wasn't really a bug so much as a design flaw, if you cache got to be enormous(we're talking 3000+ entries), it would get extremely slow. The fetching algorithm was just too inefficient for caches of that size, and I had a cache that was around 6,000 entries. I cleaned it up a bit and it was faster, but tbqh it still wasn't good enough.

Like I said before though, both of these were not just resolved later in its existence, they were massively improved. They added an entire system to support client side state which is thoroughly great, and giant caches are significantly better handled. I haven't had any issues since 2.0, but every once in awhile I wonder if a problem I'm having is actually my fault.

darthbob88
Oct 13, 2011

YOSPOS
I'm trying to do proper TDD for this new Typescript/React project of mine, using Enzyme/Jest, and I'm having issues setting up the first tests. Specifically I'm getting a lot of "Module raf/polyfill in the setupFiles option was not found" errors. If I just remove the "setupFiles" option from the config, it fails on "Module enzyme-to-json in the snapshotSerializers option was not found". I've confirmed that those modules exist in node_modules, and I'm beginning to think it's just a problem with Jest failing to resolve anything, but I'm not sure how to fix it.

Adbot
ADBOT LOVES YOU

Ape Fist
Feb 23, 2007

Nowadays, you can do anything that you want; anal, oral, fisting, but you need to be wearing gloves, condoms, protection.
I've been fiddling with MEAN, I do Angular 2 professionally but I wanted to extend that into the MEAN stack, and over the last couple of weeks I've really hammered down the creation of a pretty rudimentary MEAN application using Express & CosmosDB, Microsoft's forked MongoDB. So far it's pretty cool tbh. I'd also like to say that VSTS/Azure deployment is really loving nice and having it connect with Github to just do a build every time you do a commit it really nice.

Also, using MongoDB requires this youtube to be posted:

https://www.youtube.com/watch?v=b2F-DItXtZs

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply