Docz: [TypeScript] Props cache is cleaned on each start

Created on 30 Oct 2019  路  4Comments  路  Source: doczjs/docz

Bug Report

Docz populates a .docz/.cache/propsParser.json at the first run. It avoids unnecessary props parsing for future launches. It's done on that file: https://github.com/doczjs/docz/blob/master/core/docz-core/src/utils/docgen/typescript.ts
However, (since Gatsby ?), each docz files are "called" 2 times. First, from the project folder, and then, from the .docz folder.

On first run, nothing is called but the getInitialFilesMap() function because it's declared at the root of the file. It reads the cache and removes every files that is invalid. As the cache is populated "from" the .docz folder, paths are invalids and everything get removed.
Then, from Docz, the file is inited again (getInitialFilesMap() too but there is nothing in the cache to remove) and the props are populated with relative path from the .docz folder because the function tsParser is called (it was not during the first run).

To sum up, we should not call getInitialFilesMap from the project folder but only from the docz folder, within the tsParser call. I tried to move it before the loadFiles call (L186) because it's the only function that needs the filesMap and it worked but I don't know the side-effects as my knowledge on this part of the code is limited :neutral_face:

bug stale v2

All 4 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I still want to tackle this. Let me some time!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Kerumen is there any workaround to getting this to work? Every build takes a very long time right now :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ssylvia picture ssylvia  路  3Comments

mariusespejo picture mariusespejo  路  3Comments

YardWill picture YardWill  路  3Comments

ilyanoskov picture ilyanoskov  路  3Comments

koddr picture koddr  路  3Comments