JavaScript is secretly a functional programming language, and its functions are closures: function objects get access to variables defined in their enclosing scope, even when that scope is finished. Local variables which are captured by a closure are garbage collected once the function they are defined in has finished and all functions defined inside their scope are themselves… Continue reading A surprising JavaScript memory leak
Month: November 2024
Test Case Level of Detail
High-level test case: A high-level test case is defined as a test case without concrete values for input data and expected results. Logical operators are used; instances of the actual values are not yet defined and/ or available. For example, input age with any value > 50 and expect an error message. Low-level test case:… Continue reading Test Case Level of Detail
Sneaky React Memory Leaks: How `useCallback` and closures can bite you
A brief refresher on closures Closures are a fundamental concept in JavaScript. They allow functions to remember the variables that were in scope when the function was created. Here’s a simple example: function createCounter() { const unused = 0; // This variable is not used in the inner function let count = 0; // This… Continue reading Sneaky React Memory Leaks: How `useCallback` and closures can bite you
Garbage collection and closures
Garbage collection within a function doesn’t quite work how we expected. function demo() { const bigArrayBuffer = new ArrayBuffer(100_000_000); const id = setTimeout(() => { console.log(bigArrayBuffer.byteLength); }, 1000); return () => clearTimeout(id); } globalThis.cancelDemo = demo(); With the above, bigArrayBuffer is leaked forever. I didn’t expect that, because: After a second, the function referencing bigArrayBuffer is no longer callable.… Continue reading Garbage collection and closures
Event Loop Explained
Before we dig into the event loop, I want you to look at the following illustration. You might not understand all the components mentioned here, but it’s better to build a mental model before we start. We’ll now zoom in on each of the components one by one and build our understanding of the Event… Continue reading Event Loop Explained
Debouncing and Throttling
Debouncing and Throttling work on the same principle – delay stuff – but still have very different approach and use cases. Both the concepts are useful for developing a performant application. Almost all the websites you visit on a daily basis use Debouncing and Throttling in some way or the other. Debouncing A well known… Continue reading Debouncing and Throttling
Understanding async and defer
The script tag is used to add JavaScript to an HTML page. It could be an inline script or an external script. <body> <!– Some code before it –> <script> console.log(“This is an inline script.”); </script> <script src=”https://example.com/external-script.js” /> <!– Some code after it –> </body> While parsing the HTML, if browser encounters a script tag it… Continue reading Understanding async and defer
Test Basis
The test basis refers to the set of documents or sources of information that serve as the foundation for designing test cases and test scripts. It defines what needs to be tested and provides the input for the test design process. Examples of Test Basis: Requirements Documentation Functional specifications Business requirements User stories or use cases Design… Continue reading Test Basis
Resolving Missing Custom Sublist Data on Transaction Records
Issue: Custom sublist data is not visible on transaction records, even though the sublist is correctly defined and linked. Cause: The custom sublist is not properly configured or added to the form. Data is not saved correctly in the custom sublist due to missing field mappings or scripts. Permissions for the custom record or fields… Continue reading Resolving Missing Custom Sublist Data on Transaction Records
Fixing Email Capture Records Not Linking to Transactions
Issue: Emails captured using the Email Capture feature are not automatically linked to related transactions (e.g., sales orders or invoices). Cause: Email parsing rules are not configured correctly. The sender’s email does not match the email address on the associated customer record. The transaction type is not enabled for email capture linking. Solution: Configure Email… Continue reading Fixing Email Capture Records Not Linking to Transactions