21 lines
356 B
JavaScript
21 lines
356 B
JavaScript
// src/lazy.ts
|
|
function determineLazyBehavior(options) {
|
|
const {
|
|
hasBeenSelected,
|
|
isLazy,
|
|
isSelected,
|
|
lazyBehavior = "unmount"
|
|
} = options;
|
|
if (!isLazy)
|
|
return true;
|
|
if (isSelected)
|
|
return true;
|
|
if (lazyBehavior === "keepMounted" && hasBeenSelected)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
export {
|
|
determineLazyBehavior
|
|
};
|