Skip to content

runOnAttributeChange is not triggered in "Quick edit" #7872

@bglogic

Description

@bglogic

Description

Steps to reproduce:

  1. Create a note and call it "Kanban Child"
  2. In "Kanban Child"
    • In Owned Attributes add this label: #label:mycategory="promoted,alias=category,single,text"
    • In Basic Properties enable Template
  3. Create a note and call it "Change Color"
  4. In "Change Color"
    • In Basic Properties set Note type to JS backend
    • Paste the following code to the note. This code will change a note's color to green if its category is set to "Health" and will remove the color if the category is set to anything else:
api.runOnFrontend(function() {
    const noteId = api.getActiveContextNote().noteId;
    api.runOnBackend(function(frontendNoteId) {
        const note = api.getNote(frontendNoteId);

        const category = note.getLabelValue("mycategory");
        if (category === "Health") {
            note.setLabel("color", "green");
        } else {
            note.removeLabel("color");
        }
    }, [noteId]);
}, []);
  1. In "Kanban Child"
    • In Owned Attributes add a new relation
      • Name: runOnAttributeChange
      • Target note: Change Color
      • Click Save & close
  2. Create a note and call it "My Kanban"
  3. In "My Kanban"
    • In Basic Properties
      • Note type: Collection
    • In Collection Properties
      • View type: Board
    • In Owned Attributes add a new relation
      • Name: child:template
      • Target note: Kanban Child
    • Add a column and call it "Todo"
    • Add a new item in "Todo" and call it "Visit dentist"
    • Click on "Visit dentist" to open Quick edit
    • Set the category field value to "Health" and press Enter then close the Quick edit

If you followed the steps above you will notice the "Visit dentist" note did not change its color to green. However, if you open "Visit dentist" in a new tab, new split, or new window and set the category value to "Health" and press Enter the note's color will change to green.

I suspect this is runOnAttributeChange not triggering in Quick edit.

TriliumNext Version

0.99.5

What operating system are you using?

Other Linux

What is your setup?

Local + server sync

Operating System Version

Arch Linux x86_64 (Linux 6.17.9-arch1-1)

Error logs

No errors showing up in the backend logs or the frontend console

Metadata

Metadata

Assignees

No one assigned

    Labels

    State: TriageIssues that need to be verifiedUIIssues related to user-interface/front-end

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions