bramses / obsidian-stack-overflow

Fetch Stack Oveflow answers and copy paste them directly into Obsidian
MIT License
34 stars 0 forks source link

Uncaught (in promise) TypeError: Cannot read property 'querySelector' of null #3

Open 0xdevalias opened 2 years ago

0xdevalias commented 2 years ago

Just tried this using the following URL, then selecting 'Insert Stack Overflow Answer' from the Obsidian command menu:

https://stackoverflow.com/questions/61907922/pine-script-optimize-with-lower-timeframe-backtest

Which resulted in the following error in the DevTools console:

Uncaught (in promise) TypeError: Cannot read property 'querySelector' of null
    at StackOverflowAnswers.eval (plugin:obsidian-stack-overflow:5575)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-stack-overflow:36)

I haven't looked any deeper into the what/why of it at this stage.

bramses commented 2 years ago

It only works on answers currently. For example (the first answer from the url: https://stackoverflow.com/a/72722933/3952024) creates:

Does that help?


Pine-Script + Optimize with lower timeframe, backtest

As of May 30, 2022; if you have a Premium TradingView account (the highest level) then you can make use of the new 'Bar Magnifier' feature (https://www.tradingview.com/blog/en/accurate-backtesting-with-bar-magnifier-31746/), which seems to allow for this finer grain accuracy:

Premium account holders can now obtain more realistic order fills in their strategy backtests by using The Bar Magnifier option. This tool uses intrabar inspection to obtain deeper granularity on price movement within a bar, allowing for more precise order fills.

View Answer on Stack Overflow


0xdevalias commented 2 years ago

nods yeah, that makes sense as to why it wasn't working for me. It would be useful if it was able to pull questions as well, but understand that may be out of scope.

Edit: As per the changes suggested in https://github.com/bramses/obsidian-stack-overflow/issues/4#issuecomment-1165030045, having the script return a user friendly error/similar when trying to convert an answer URL (or perhaps just ignoring it and not trying to convert it since it's not handled?) could be a nice fix here.