obsidian-community / obsidian-full-calendar

Keep events and manage your calendar alongside all your other notes in your Obsidian Vault.
https://obsidian-community.github.io/obsidian-full-calendar/
MIT License
807 stars 109 forks source link

Workaround for dataviewjs first render bug #250

Open rafapgoncalves opened 1 year ago

rafapgoncalves commented 1 year ago

Thank you for the plugin.

Just so you know, I managed to workaround this issue:

https://github.com/davish/obsidian-full-calendar/blob/276bbd2f17b07230a6c6f6729d89a615c40ad8fa/docs/advanced/dataview.md?plain=1#L5-L14

by adding this line right after calendar.render():

window.setTimeout(_ => {calendar.changeView('timeGridWeek');}, 1);

Can't see any reason why it wouldn't work for everybody. If so, it could be addressed here:

https://github.com/davish/obsidian-full-calendar/blob/276bbd2f17b07230a6c6f6729d89a615c40ad8fa/src/ui/calendar.ts#L39

Adding this right before the return statement should do the trick, right?

window.setTimeout(_ => {cal.changeView(
    settings?.initialView?.[isNarrow ? "mobile" : "desktop"] ||
            (isNarrow ? "timeGrid3Days" : "timeGridWeek"));}, 1);

Thanks again.

vran-dev commented 1 year ago

thank you very much, it's useful