jbilcke-hf / clapper

Clapper.app, a video synthesizer and sequencer designed for the age of AI cinema
https://clapper.app
GNU General Public License v3.0
2.08k stars 194 forks source link

fix: screenplay not loaded when importing txt or clap #35

Closed devniel closed 3 months ago

devniel commented 3 months ago

Hi,

The useEffect with getClap was not detecting changes, refactoring it to use meta is a simple fix but I think a better approach is to fill the proper store when setting timeline.setClap() to avoid complications with useEffect apart of avoiding additional renders. An even better approach could be to have a global store where to proxy calls to TimelineStore and ScriptEditorStore via a unique setClap, I think we could do that in the future.

jbilcke-hf commented 3 months ago

thank you! will merge you PR, we can do a bit of refactoring later!

for some context about why this changed:

until to a few days ago, the useTimeline() stored a copy of the .clap file,

but this was a bit redundant and confusing (ie. should we modify segments or clap.segments etc) so I've removed this copy of .clap file and exposed all the content directly in the store (but meta is still a nested object, which can be a bit tricky to handle)