yeah, so I don't see a lot of duplicated code here
2020-06-04 15647, 2020
alastairp
if the result of duplicating 2 lines of code is that the initial page load is faster, I'm super happy with that tradeoff
2020-06-04 15625, 2020
alastairp
would love to see how to get server-side rendering going from flask->react like musicbrainz does :)
2020-06-04 15627, 2020
alastairp
later later
2020-06-04 15629, 2020
Mr_Monkey
I guess one issue is that it's not usual to see query parameters in our APIs that way (/api/data?page=1 would most likely be /api/data/1), so you would have a bit more code to parse that
2020-06-04 15622, 2020
alastairp
to me that's basically an implementation detail, so I'm not too worried
2020-06-04 15635, 2020
alastairp
so, how much extra work is the frontend to load data from both places? (I guess this is another tradeoff we need to consider?)
2020-06-04 15639, 2020
yvanzo
bitmap: would it be alright to map IP hashes to work titles at random in redis?
2020-06-04 15605, 2020
Mr_Monkey
Not a lot of extra work.
2020-06-04 15607, 2020
bitmap
hm?
2020-06-04 15644, 2020
alastairp
that's cool
2020-06-04 15603, 2020
yvanzo
bitmap: or just disable IP hashes on test.mb.o.
2020-06-04 15610, 2020
alastairp
do you have time to play with json-schema? do you think it's worth looking at what it can give us?
2020-06-04 15638, 2020
bitmap
I'd just add a dbdefs setting to disable it
2020-06-04 15652, 2020
Mr_Monkey
I mean, you see it there in the jsx: if there's data passed in props by the server, blindly use that. The other part is calling an API to get more results, which we should be doing anyway for the sake of being in 2020 and not having to reload a react page to get page 2…
2020-06-04 15601, 2020
Mr_Monkey
alastairp: Not sure how json-schema fits in there, to be honest
2020-06-04 15619, 2020
zas
reosarevok: it was a general issue with musicbrainz, but we still have an issue with Picard 1.4, which will be removed from website soon, as we don't have a fix (SSL cert seems to be embedded in Qt4)
Mr_Monkey: endpoint for automatic schema generation
2020-06-04 15657, 2020
Mr_Monkey
There's an idea in there somewhere. Export jsonschema files from flask, import them and trnasform them in typescript types, use the type to implement the components.
2020-06-04 15657, 2020
Mr_Monkey
Seems like a big hassle for keeping props in sync, IMO.
2020-06-04 15613, 2020
Mr_Monkey
neat
2020-06-04 15623, 2020
alastairp
mmm, right. if we have to do a manual step to keep them in sync then that sucks
2020-06-04 15657, 2020
Mr_Monkey
Well, I'm not sure what we'd do with an endpoint like that, considering the hints we need are not at runtime but ideally integrated in our IDEs
2020-06-04 15610, 2020
alastairp
yeah, I just realised that
2020-06-04 15614, 2020
Mr_Monkey
It could possibly be semi-automatic
2020-06-04 15622, 2020
alastairp
and we could have tests
2020-06-04 15642, 2020
alastairp
that compare the python object->schema->props and js props
2020-06-04 15613, 2020
Mr_Monkey
Probably easier yes
2020-06-04 15639, 2020
alastairp
you know, I'm cautiously optimistic that this is a good idea
2020-06-04 15658, 2020
blinky42 joined the channel
2020-06-04 15614, 2020
alastairp
if you set props in typescript like that example you linked, will it raise a runtime error if you perform an API call and the data doesn't match the expected format?
2020-06-04 15658, 2020
Mr_Monkey
> if you perform an API call
2020-06-04 15658, 2020
Mr_Monkey
That's at runtime…
2020-06-04 15611, 2020
alastairp
yeah, that's what I'm asking
2020-06-04 15618, 2020
Mr_Monkey
Typescript is not at runtime at all
2020-06-04 15626, 2020
alastairp
that is to say - what functionality are we giving ourselves here?
2020-06-04 15630, 2020
alastairp
autocomplete in the IDE?
2020-06-04 15638, 2020
Mr_Monkey
Yes
2020-06-04 15642, 2020
Mr_Monkey
Not much else
2020-06-04 15646, 2020
alastairp
mmm, right
2020-06-04 15655, 2020
Mr_Monkey
Well, validation and autocomplete in IDE
2020-06-04 15610, 2020
alastairp
because in js you could easily take a jsonschema and an object and validate that the object is correct, right?
2020-06-04 15621, 2020
Mr_Monkey
And, if your tests run a typescrit checker, you can fail that test if it implements it wrong
2020-06-04 15633, 2020
Mr_Monkey
Yes.
2020-06-04 15610, 2020
alastairp
but in that case we'd probably have to commit both the json-schema _and_ .ts to the repository, and then have the js frontend download the schema to the client in order to do the validation
2020-06-04 15626, 2020
alastairp
which is naff
2020-06-04 15640, 2020
Mr_Monkey
Agreed
2020-06-04 15621, 2020
alastairp
OK, give me a few minutes, I'm going to try and automatically extract schemas and run this js package