Skip to content

Conversation

@CSWinnall
Copy link
Collaborator

@CSWinnall CSWinnall commented Dec 2, 2025

Refactors form data loading to enhance reliability, modularity, and error handling when restoring persistent form fields. Knacks connection fields have a habit of loading later than the view and under past issues we have had they can mutate even after the knack connections load triggers. Most of this refactor is to gurantee that the connections load the correct value. Introduces robust connection field hydration with retry logic and event-driven updates, reducing race conditions and ensuring consistent restoration across various field types. Converted some code to vanilla JS ready for the KTL-NG (Not Chosen & Redactor as Jquery Plugins).

Improves maintainability by modularizing field hydration, handling corrupted storage, and optimizing field-specific logic.

…a user has changed them or not. Connection fields now reliably load last values. Added multiple retries to make sure.

Refactors form data loading to enhance reliability, modularity, and error handling when restoring persistent form fields . Introduces robust connection field hydration with retry logic and event-driven updates, reducing race conditions and ensuring consistent restoration across various field types.  Converted some code to vanilla JS ready for the KTL-NG (Not Chosen & Redactor as Jquery Plugins).

Improves maintainability by modularizing field hydration, handling corrupted storage, and optimizing field-specific logic.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the persistent form data loading mechanism to improve reliability and maintainability. The key improvements include modularizing field hydration logic, adding robust retry mechanisms for connection fields, implementing event-driven updates, and migrating portions of the code to vanilla JavaScript in preparation for reducing jQuery dependencies.

Key Changes:

  • Introduced retry logic with exponential backoff and event-driven updates for connection field hydration to handle race conditions
  • Refactored monolithic form loading into separate, focused hydration functions for each field type
  • Added enhanced error handling for corrupted storage data with graceful fallbacks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…d improves field value handling

Unifies and streamlines scene/view loaded marking, replacing duplicated code with reusable functions for improved maintainability.

Enhances field hydration logic for text, connection, and multiple-choice fields with better attribute escaping, input normalization, and robust error handling.

Removes unreliable event-based connection hydration retries, switching to simpler logic for more predictable behavior.

Fixes typos in selector class names to ensure correct event triggering.

Refactors persistent form hydration and improves reliability

Streamlines scene and view loaded logic by consolidating marking into reusable functions, improving maintainability and event consistency.

Enhances field hydration for text, connection, and multiple-choice types with better value normalization, robust error handling, and improved attribute escaping.

Removes unreliable event-based connection hydration retries for more predictable field population.

Corrects class name typos to ensure events trigger as intended.

Addresses maintainability, hydration accuracy, and user experience for persistent forms.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 17 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CSWinnall CSWinnall removed the request for review from cortexrd December 3, 2025 10:55
Enhances connection field hydration with verification and
retry logic, ensuring field values are correctly applied before
finalizing persistence. Adds pending-save queuing to prevent
data loss during hydration, and introduces exponential backoff
for retries, reducing UI glitches and persistence errors.

Improves boolean field handling and normalizes value checks
for more robust data application.
@CSWinnall CSWinnall requested a review from cortexrd December 3, 2025 11:13
Refactors form data hydration logic to better handle Knack mutations after connection loads, preventing loss of restored values.

Adds rating widget persistence and refines date/time
field handling for reliability.
Keeps cached values across refreshes until submit, scene change, or expiry.

Fully tested in KTL-tutorials app.
@cortexrd cortexrd merged commit 48a485f into dev Dec 12, 2025
1 check passed
@cortexrd cortexrd deleted the fix/_rlv-reloading-connection-fields branch December 12, 2025 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants