mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-11-03 18:00:11 +00:00 
			
		
		
		
	Fixes a race condition when initializing the calendar-event field
The problem was that the field executes a request to validate its state. This was initiated at the same time for two values. Then it was undetermined which value comes back first.
This commit is contained in:
		@@ -2,6 +2,7 @@ module Comp.CalEventInput exposing
 | 
			
		||||
    ( Model
 | 
			
		||||
    , Msg
 | 
			
		||||
    , init
 | 
			
		||||
    , initDefault
 | 
			
		||||
    , update
 | 
			
		||||
    , view
 | 
			
		||||
    )
 | 
			
		||||
@@ -36,6 +37,11 @@ type Msg
 | 
			
		||||
    | CheckInputMsg CalEvent (Result Http.Error CalEventCheckResult)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
initDefault : Model
 | 
			
		||||
initDefault =
 | 
			
		||||
    Model Nothing
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
init : Flags -> CalEvent -> ( Model, Cmd Msg )
 | 
			
		||||
init flags ev =
 | 
			
		||||
    ( Model Nothing, checkInput flags ev )
 | 
			
		||||
 
 | 
			
		||||
@@ -133,8 +133,8 @@ init flags =
 | 
			
		||||
        initialSchedule =
 | 
			
		||||
            Data.Validated.Unknown Data.CalEvent.everyMonth
 | 
			
		||||
 | 
			
		||||
        ( sm, sc ) =
 | 
			
		||||
            Comp.CalEventInput.init flags Data.CalEvent.everyMonth
 | 
			
		||||
        sm =
 | 
			
		||||
            Comp.CalEventInput.initDefault
 | 
			
		||||
    in
 | 
			
		||||
    ( { settings = Api.Model.NotificationSettings.empty
 | 
			
		||||
      , connectionModel =
 | 
			
		||||
@@ -159,7 +159,6 @@ init flags =
 | 
			
		||||
    , Cmd.batch
 | 
			
		||||
        [ Api.getMailSettings flags "" ConnResp
 | 
			
		||||
        , Api.getTags flags "" GetTagsResp
 | 
			
		||||
        , Cmd.map CalEventMsg sc
 | 
			
		||||
        ]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -136,8 +136,8 @@ init flags =
 | 
			
		||||
        initialSchedule =
 | 
			
		||||
            Data.Validated.Unknown Data.CalEvent.everyMonth
 | 
			
		||||
 | 
			
		||||
        ( sm, sc ) =
 | 
			
		||||
            Comp.CalEventInput.init flags Data.CalEvent.everyMonth
 | 
			
		||||
        sm =
 | 
			
		||||
            Comp.CalEventInput.initDefault
 | 
			
		||||
    in
 | 
			
		||||
    ( { settings = Api.Model.ScanMailboxSettings.empty
 | 
			
		||||
      , connectionModel =
 | 
			
		||||
@@ -168,7 +168,6 @@ init flags =
 | 
			
		||||
      }
 | 
			
		||||
    , Cmd.batch
 | 
			
		||||
        [ Api.getImapSettings flags "" ConnResp
 | 
			
		||||
        , Cmd.map CalEventMsg sc
 | 
			
		||||
        , Api.getFolders flags "" False GetFolderResp
 | 
			
		||||
        ]
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user