javalent / dice-roller

Inline dice rolling for Obsidian.md
272 stars 29 forks source link

Table roller doesn't query note per roll #321

Closed Shyclops closed 1 week ago

Shyclops commented 4 months ago

Check for existing bug reports before submitting.

Expected Behavior

Table roller checks table on each roll

Current behaviour

Table roller seems to query and cache table, which ignores change

image

Reproduction

Setup

have two notes, one with table Test
a
a
b
b

the other with dice: note1#^test-table

roll the table once

Steps

  1. DO NOT CLOSE THE NOTE WITH THE DICE ROLLER
  2. open the table note outside of obsidian (might work in obsidian, just not how i tested) and delete all table rows with b
  3. roll the table again
  4. repeat until table rolls "b"

Notes: This should work as long as the note with the table roller isn't refreshed, no matter how the table is edited I've tested this with both metabind regex edit as well as editing it in sublime

Which Operating Systems are you using?

Obsidian Version Check

1.6.2

Plugin Version

11.0.4

Confirmation

Possible solution

re parse the table every time the button is pressed, if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash

valentine195 commented 1 week ago

if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash

The reason this is done is to avoid re-reading the note content, not re-generating the options.

How often are you changing tables outside of Obsidian while using Dice Roller? I am inclined to close this, as it seems like a relatively obscure issue.

edit: actually I believe I removed the file-watching entirely, so it doesn't work with editing inside Obsidian either. Let me investigate re-adding it, I removed it because things were not being destroyed correctly.

valentine195 commented 1 week ago

This was fixed in v11.1.0

Shyclops commented 1 week ago

Haha

I might be in the minority, I found this when using dice roller on a table that changed each time I rolled it (I was simulating drawing a stone from a bag so I was removing an option each roll, or resetting the bag, was for 13th age and I'm a chaos mage so I don't get to pick the type of spell I cast)

Sent from Proton Mail Android

-------- Original Message -------- On 9/25/24 9:48 AM, Jeremy Valentine wrote:

if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash The reason this is done is to avoid re-reading the note content, not re-generating

DuckDuckGo removed one tracker. More

Deactivate

if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash

The reason this is done is to avoid re-reading the note content, not re-generating the options.

How often are you changing tables outside of Obsidian while using Dice Roller? I am inclined to close this, as it seems like a relatively obscure issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Shyclops commented 1 week ago

Technically it's done inside of obsidian but I guess meta-bind regex buttons don't count

Sent from Proton Mail Android

-------- Original Message -------- On 9/25/24 9:48 AM, Jeremy Valentine wrote:

if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash The reason this is done is to avoid re-reading the note content, not re-generating

DuckDuckGo removed one tracker. More

Deactivate

if performance is a concern, hash the table and compare the hash, if the hash is different, update the table and hash

The reason this is done is to avoid re-reading the note content, not re-generating the options.

How often are you changing tables outside of Obsidian while using Dice Roller? I am inclined to close this, as it seems like a relatively obscure issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>