ionide / Fornax

Scriptable static site generator using type safe F# DSL to define page templates.
MIT License
241 stars 44 forks source link

SiteContents are not reset when md parsing and loader type are in library. #108

Open Freymaurer opened 2 years ago

Freymaurer commented 2 years ago

Is your feature request related to a problem? Please describe. Hello I am writing a class library for my markdig extensions, markdown parsing and core generator components. Everything is in this project and i noticed some strange behavior I don't really understand.

The hot reload triggers and markdown parsing happens and everything gets added to SiteContents on the loader level, but when i check the number of values of that specific type i see, that everytime i trigger the hot reload it just adds the new version to the existing values. And because i use Seq.find to find the correct html for my generator it returns the first fitting value, which is the old and not updated one.

So my question is: How does this happen? Can i somehow avoid this behavior?

Describe the solution you'd like It works exactly the same way it works without using a library.

Describe alternatives you've considered I started using Seq.findBack to always return the newest addition, but this will lead to problems if i hot reload to often as the values will not get dumped this way. I could also initiate a new SiteContext in my loader, some very superficial testing showed that this could work, but there might be issues i am not aware of.

Additional context