Mara-Li / obsidian-snippet-downloader

A way to manage snippets (download / update) from repository
GNU Affero General Public License v3.0
76 stars 0 forks source link

[BUG]: Settings is totally blank #6

Open namtrah opened 1 year ago

namtrah commented 1 year ago

Describe the bug I tried to add a direcotry under a repo and afterwards, the settings screen went completely blank. I cannot reload it (even restarting Obsidian doesn´t help after deleting the data.json file.

To Reproduce

plugin:obsidian-snippet-downloader:1505 Uncaught TypeError: settings.snippetList is not iterable
    at getAllSnippet (plugin:obsidian-snippet-downloader:1505:34)
    at SnippetDownloaderTabs.display (plugin:obsidian-snippet-downloader:1638:25)
    at t.openTab (app.js:1:2104235)
    at HTMLDivElement.<anonymous> (app.js:1:2102674)
getAllSnippet @ plugin:obsidian-snippet-downloader:1505
display @ plugin:obsidian-snippet-downloader:1638
t.openTab @ app.js:1
(anonymous) @ app.js:1

Log See above.

Desktop :

namtrah commented 1 year ago

Uncaught (in promise) TypeError: settings.snippetList is not iterable at getAllSnippet (plugin:obsidian-snippet-downloader:1505:34) at SnippetDownloaderTabs.display (plugin:obsidian-snippet-downloader:1638:25) at SnippetDownloaderTabs.eval (plugin:obsidian-snippet-downloader:1672:18) at Generator.next () at fulfilled (plugin:obsidian-snippet-downloader:50:24)

After deleting from BRAT and reinstalling. I tried the ITS Snippets from SlrVb. The same thing happened with the above error.

Mara-Li commented 1 year ago

Oupppps sorry for the delay, i just remember I wrote this plugin 🤡

Mara-Li commented 1 year ago

I will check, because i don't have any error on my side :( Could you please send me your data.json file, and your version ?

darkmarcos commented 1 year ago

Same problem here. Specially when I try to add new repository without any snippet.

Mara-Li commented 1 year ago

Could you provide a reproducible report ?

sigrunixia commented 1 year ago

Could you provide a reproducible report ?

Hello! I hope I can be of help. I have a snippet in a repo I am managing and am now super interested in making sure it works with this plugin. :)

Here are the steps I took to make this go wonky. On a fresh install of the plugin.

  1. Install Plugin from Community Plugins
  2. Everything Looks Good.
  3. Go to https://github.com/SlRvb/Obsidian--ITS-Theme and add the repo.
  4. Repo added successfully to plugin.
  5. Remove all the snippets from the plugin I dont want to update.
  6. Remove all the snippets from the snippets folder I dont want to keep.
  7. Intentionally do something to change appearance, just to simulate passage of time/see if something else interferes. In this case, I changed theme from default to AnuPp.
  8. Try to add a new repo to the plugin - https://github.com/mProjectsCode/obsidian-pathfinder2e-statblocks
  9. Get the error you see below.
plugin:obsidian-snippet-downloader:784          GET https://api.github.com/repos/mProjectsCode/obsidian-pathfinder2e-statblocks/git/trees/main?recursive=true 404
fetchWrapper @ plugin:obsidian-snippet-downloader:784
request3 @ plugin:obsidian-snippet-downloader:888
eval @ plugin:obsidian-snippet-downloader:85
Promise.then (async)
register @ plugin:obsidian-snippet-downloader:83
newApi @ plugin:obsidian-snippet-downloader:894
eval @ plugin:obsidian-snippet-downloader:1343
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
listSnippetfromRepo @ plugin:obsidian-snippet-downloader:1335
eval @ plugin:obsidian-snippet-downloader:1409
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
addSnippet @ plugin:obsidian-snippet-downloader:1404
eval @ plugin:obsidian-snippet-downloader:1669
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
eval @ plugin:obsidian-snippet-downloader:1667
eval @ plugin:obsidian-snippet-downloader:386
(anonymous) @ app.js:1
plugin:obsidian-snippet-downloader:784          GET https://api.github.com/repos/mProjectsCode/obsidian-pathfinder2e-statblocks/git/trees/main?recursive=true 404
fetchWrapper @ plugin:obsidian-snippet-downloader:784
request3 @ plugin:obsidian-snippet-downloader:888
eval @ plugin:obsidian-snippet-downloader:85
Promise.then (async)
register @ plugin:obsidian-snippet-downloader:83
newApi @ plugin:obsidian-snippet-downloader:894
eval @ plugin:obsidian-snippet-downloader:1352
rejected @ plugin:obsidian-snippet-downloader:57
Promise.then (async)
step @ plugin:obsidian-snippet-downloader:62
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
listSnippetfromRepo @ plugin:obsidian-snippet-downloader:1335
eval @ plugin:obsidian-snippet-downloader:1409
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
addSnippet @ plugin:obsidian-snippet-downloader:1404
eval @ plugin:obsidian-snippet-downloader:1669
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
eval @ plugin:obsidian-snippet-downloader:1667
eval @ plugin:obsidian-snippet-downloader:386
(anonymous) @ app.js:1
plugin:obsidian-snippet-downloader:1505 Uncaught (in promise) TypeError: settings.snippetList is not iterable
    at getAllSnippet (plugin:obsidian-snippet-downloader:1505:34)
    at SnippetDownloaderTabs.display (plugin:obsidian-snippet-downloader:1638:25)
    at SnippetDownloaderTabs.eval (plugin:obsidian-snippet-downloader:1672:18)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-snippet-downloader:50:24)
getAllSnippet @ plugin:obsidian-snippet-downloader:1505
display @ plugin:obsidian-snippet-downloader:1638
eval @ plugin:obsidian-snippet-downloader:1672
fulfilled @ plugin:obsidian-snippet-downloader:50
Promise.then (async)
step @ plugin:obsidian-snippet-downloader:62
fulfilled @ plugin:obsidian-snippet-downloader:50
Promise.then (async)
step @ plugin:obsidian-snippet-downloader:62
eval @ plugin:obsidian-snippet-downloader:63
__async @ plugin:obsidian-snippet-downloader:47
eval @ plugin:obsidian-snippet-downloader:1667
eval @ plugin:obsidian-snippet-downloader:386
(anonymous) @ app.js:1

If you go navigate away from the blank settings page and come back, it repeats the "settings.snippetList is not iterable."

The Plugin Readme states it can pull all snippets from the repo but is there specific places it is looking for first, and then generically searching afterwards?

Examples: Repo/Snippets Repo/Css Snippets Repo/Extras

If not, would it you be amendable to adding or suggesting that functionality to encourage some uniformity, which only helps make your plugin more resilient? It's brilliant otherwise, and deserves much more recognition than it receives.

Screenshot

image
sigrunixia commented 1 year ago

I am no longer experiencing this issue. How about you @namtrah ?

jhilker98 commented 1 year ago

I've encountered this issue.

What I found @namtrah is that you have to add the repo with the username/repo format and not the full github link to the repo.

namtrah commented 1 year ago

Well, yes it just happened. What I see is that it disappears once you enter an incorrect reponame. For example. I wanted just the CSS from the ITS Theme and entered this name SlRvb/Obsidian--ITS-Theme/tree/main/Snippets instead of SlRvb/Obsidian--ITS-Theme. After that the Settings panel was empty. and this error popped up in the console.

plugin:obsidian-snippet-downloader:1505 Uncaught TypeError: settings.snippetList is not iterable
    at getAllSnippet (plugin:obsidian-snip…-downloader:1505:34)
    at SnippetDownloaderTabs.display (plugin:obsidian-snip…-downloader:1638:25)
    at t.openTab (app.js:1:2719625)
    at HTMLDivElement.<anonymous> (app.js:1:2718064)
jhilker98 commented 1 year ago

What I had to do was use SlRvb/Obsidian--ITS-Theme for the exact repo, instead of SlRvb/Obsidian--ITS-Theme/tree/main/Snippets.

namtrah commented 1 year ago

I agree, but my point is, I was able to recreate this error with the latest code using that recreation scenario.

jhilker98 commented 1 year ago

Ahh, alright - my bad.

On Tue, Aug 1, 2023, 8:22 AM Namtrah Kcirt @.***> wrote:

I agree, but my point is, I was able to recreate this error with the latest code using that recreation scenario.

— Reply to this email directly, view it on GitHub https://github.com/Lisandra-dev/obsidian-snippet-downloader/issues/6#issuecomment-1660205646, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACY54OE22EMFI4C6PYDTOATXTDYKDANCNFSM6AAAAAASGAJU7Y . You are receiving this because you commented.Message ID: @.***>