Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Weekly Note crashes if calendar view hasn't been opened yet #377

Open
oowekyala opened this issue Nov 1, 2024 · 2 comments
Open

Open Weekly Note crashes if calendar view hasn't been opened yet #377

oowekyala opened this issue Nov 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@oowekyala
Copy link

Describe the bug

The command "Open Weekly Note" crashes with "Uncaught TypeError" when the calendar view has not been opened yet.

Steps to reproduce

  1. Open obsidian, do not show the calendar view
  2. Execute "Open Weekly Note" from command palette

Nothing happens but an error is logged in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'openOrCreateWeeklyNote')
    at Object.checkCallback (plugin:calendar:4419:27)
    at OK (app.js:1:2117643)
    at t.onChooseItem (app.js:1:2726336)
    at t.onChooseSuggestion (app.js:1:1760272)
    at t.selectSuggestion (app.js:1:1759742)
    at e.useSelectedItem (app.js:1:1433276)
    at Object.func (app.js:1:1430675)
    at e.handleKey (app.js:1:754496)
    at e.onKeyEvent (app.js:1:755752)

It's this line:

this.view.openOrCreateWeeklyNote(window.moment(), false);

The view field is undefined and this crashes the function.

Note that you have to start obsidian in such a state that the calendar view is not created on startup (i think). For instance if you open the calendar view then slide the pane out of view, the command works, presumably because the view still exists somewhere. However if you blend out the pane, then shutdown and restart obsidian, then that view is not created on startup.

Expected behavior

Weekly note is opened whether calendar view has been opened or not

Environment (please specify)

OS

Linux

Obsidian Version (e.g. v0.10.6)

(Settings → About → Current Version)
v1.7.4

Calendar version 1.5.10

Thank you for this plugin!

@oowekyala oowekyala added the bug Something isn't working label Nov 1, 2024
@ksdavidc
Copy link

This is due to changes in how views are loaded in latest obsidian. See here https://obsidian.md/changelog/2024-10-16-desktop-v1.7.4/ and here. https://docs.obsidian.md/Plugins/Guides/Understanding+deferred+views

@colintedford
Copy link

I ended up disabling Calendar because of this. I believe it also affects the core Daily Notes plugin because I switched to that and still have Calendar disabled, but I don't remember now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@colintedford @oowekyala @ksdavidc and others