politeiagui
politeiagui copied to clipboard
[cms] Invoice page pulling too much info
- Invoice page (at
/invoices/{token}
) is making a batch request for all proposals it needs to show line items. - The response contains an overkill amount of info about the proposals, including proposal files.
- The more proposals are used in the invoice, and the more and bigger files they have, the bigger the download will be. As a real example, invoice using 4 text-only proposals pulls 40K (18K compressed) batch response. This can get much worse if attachments are not filtered for this call (I didn't test it with a proposal that has attachments).
- All that is currently needed for display is proposal tokens and their titles.
- In the future it may be needed to fetch some extra metadata for proposal owner's review (like proposal validity period and budget limit).
- In any case, it shouldn't pull more than ~2-3K of JSON data in most cases.
- I suggest to start from removing the biggest offender - not putting base64-encoded proposal files into the response.
- Ideally, remove more unneeded data from the response like keys/sigs/censorshiprecord/etc.
- And then I recommend to specify and freeze what should be in the batch response for this page to prevent unwanted fields creeping in in the future.
I think this requires backend work. The details of some proposal is returned by an api call, so, IMO, the best solution should be create a new route and return only the { name, token, timestamp }
, maybe.
tlog PR already includes includefiles
boolean when requesting proposals, the invoice page will be adapted as well, and i think this might solve the issue.
sure! it should work @amassarwi! thanks!
This also affects the New Invoice page at /invoices/new
. Just fetched around 3 MB to populate the dropdown.