paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
14 stars 3 forks source link

Initial values for certain fields on Project Settings are not displaying from contribution file on packaged app #919

Open roopa0222 opened 1 month ago

roopa0222 commented 1 month ago

Describe the bug In my automation when I work with packaged application "Platform.Bible 0.2.0.exe".I am seeing different behavior for initial project settings compared to development environment.

On the initial load when the extension comes up the Project Settings Default for ItemPages (number/Integer) is not showing from the contribution (projectSettinsg.json) instead it is coming from the hook. I also noticed the same for ''platformScripture.booksPresent''.

After 'Reload Extensions' from the main menu on P.B , values are displayed as expected.

To Reproduce Steps to reproduce the behavior:

  1. Added property in projectSetting.json contribution file with below information
      "paranextExtTesting.itemsPerPage_projectSetting_TC13": {
        "label": "%paranextExtTesting.itemsPerPage%",
        "default": 15,
        "minimum": 5,
        "maximum": 20,
        "shouldAllowProgrammaticChanges": true,
        "includeProjectTypes": ["ParatextStandard"]
      },
  2. On the web-view

    
    const [projectItems, setProjectItemsInternally] = useProjectSetting(
    'ParatextStandard',
    'b4c501ad2538989d6fb723518e92408406e232d3',
    'paranextExtTesting.itemsPerPage_projectSetting_TC13',
    10,
    );
    
    const [projectParatextStandard] = useProjectSetting(
    'ParatextStandard',
    'b4c501ad2538989d6fb723518e92408406e232d3',
    'platformScripture.booksPresent',
    '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    );

**Expected behavior**
The UI should have ProjectSettings Items as 15 from contribution instead of 10 from hook

Logs and screenshot
[main_ProjectSettings.log](https://github.com/user-attachments/files/15535682/main_ProjectSettings.log)
[TerminlaLog_ProjectSettings.txt](https://github.com/user-attachments/files/15535683/TerminlaLog_ProjectSettings.txt)
![InitialLoad_ProjectSettings](https://github.com/paranext/paranext-core/assets/133702629/d46c7417-f2a1-4e18-a937-08035f976959)
roopa0222 commented 1 month ago

The display of initial values on the first load is not consistent. Some times it works and in some cases it is not.

tjcouch-sil commented 3 weeks ago

I suspect this is a race condition between the PDPF coming up and the web view coming up. Possibly the same fix will also fix #941