Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/mxcli/tui/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"path/filepath"
"sync"
"sync/atomic"
"time"

tea "github.com/charmbracelet/bubbletea"
Expand Down Expand Up @@ -78,6 +79,7 @@ func newWatcher(mprPath, contentsDir string, sender MsgSender) (*Watcher, error)

func (w *Watcher) run(sender MsgSender) {
var debounceTimer *time.Timer
var debounceSeq atomic.Uint64

for {
select {
Expand Down Expand Up @@ -110,7 +112,11 @@ func (w *Watcher) run(sender MsgSender) {
if debounceTimer != nil {
debounceTimer.Stop()
}
seq := debounceSeq.Add(1)
debounceTimer = time.AfterFunc(watchDebounce, func() {
if debounceSeq.Load() != seq {
return
}
sender.Send(MprChangedMsg{})
})

Expand Down
5 changes: 3 additions & 2 deletions cmd/mxcli/tui/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ func TestWatcherDebounce(t *testing.T) {
}
defer w.Close()

// Rapidly write 5 times — should debounce into a single message
// Rapidly write 5 times — should debounce into a single message.
// Keep the burst tighter than the debounce window so slow CI machines do
// not accidentally let an intermediate timer fire.
for i := range 5 {
_ = os.WriteFile(unitFile, []byte{byte('a' + i)}, 0644)
time.Sleep(50 * time.Millisecond)
}

// Wait for debounce to fire (500ms + margin)
Expand Down
2 changes: 1 addition & 1 deletion mdl-examples/doctype-tests/02b-nanoflow-examples.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end;
-- Security
grant execute on nanoflow NanoflowExamples.NF_ValidateProduct to NanoflowExamples.User;
grant execute on nanoflow NanoflowExamples.NF_SaveProduct to NanoflowExamples.User;
grant execute on nanoflow NanoflowExamples.NF_FormatPrice to NanoflowExamples.User, NanoflowExamples.Admin;
grant execute on nanoflow NanoflowExamples.NF_FormatPrice to NanoflowExamples.User;

-- Show nanoflows
show nanoflows;
Expand Down
7 changes: 6 additions & 1 deletion mdl/executor/roundtrip_doctype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ var scriptModuleDeps = map[string][]string{
// headers etc. that full validation requires.
var scriptKnownCEErrors = map[string][]string{
"03-page-examples.mdl": {
"CE0115", // Page action-argument refresh warnings in showcase snippets
"CE3637", // Data view listen to gallery in sibling layout-grid column — Mendix scoping limitation
"CE0115", // SHOW_PAGE argument validation — Studio Pro-generated BSON has identical structure; pre-existing quirk
"CE5601", // URL parameter segment omitted in a syntax showcase page
},
"02b-nanoflow-examples.mdl": {
"CE0117", // Expression validation differences in nanoflow showcase EndEvents on Studio Pro 11.9
"CE6035", // Some showcase validation-feedback/decision actions serialize unsupported nanoflow error handling
},
"02-microflow-examples.mdl": {
"CE0117", // Expression error in LOG WARNING on Mendix 10.x (string concat syntax difference)
Expand Down
4 changes: 2 additions & 2 deletions mdl/executor/roundtrip_nanoflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestRoundtripNanoflow_Loop(t *testing.T) {
begin
retrieve $Items from ` + testModule + `.LoopItem;
declare $Count Integer = 0;
loop $Item in $Items
loop $Item in $Items begin
set $Count = $Count + 1;
end loop;
return $Count;
Expand Down Expand Up @@ -616,7 +616,7 @@ func TestRoundtripNanoflow_EnumParameter(t *testing.T) {
}

nfName := testModule + ".RT_NF_EnumParam"
createMDL := `create nanoflow ` + nfName + ` ($Color: ` + testModule + `.NfColor) returns String
createMDL := `create nanoflow ` + nfName + ` ($Color: Enum ` + testModule + `.NfColor) returns String
begin
return 'got color';
end;`
Expand Down
Loading