data-mesh-asset URL and the client dynamically imports it when the component isn't already registered; the previous polling retry loop is removed.MeshComponent::getMeshViewPath() now refreshes its per-class cached view when the package view is newer, so package view updates propagate without requiring consumers to manually clear storage/framework/views/mesh-*.blade.php.maxRenderAttempts and renderDelay on initLivewireMesh config are unused (dynamic asset loading replaced the retry loop). They remain accepted for backward compatibility and will be removed in a future version.Added Livewire 4 support.
Added a new useErrorBag hook.
Which makes the error bag from laravel validation available for use.
const $wire = useWire();
const [userName, setUserName] = useEntangle<string>('user_name');
const errors = useErrorBag();
useEffect(() => {
console.log({
errors
})
}, [errors]);
return <>
{/* ....... */}
<TextInput value={userName} onChange={setUserName} hasErrors={errors['user_name'] !== null}/>
<ErrorMessage error={errors['user_name']}/>
<Button onClick={() => $wire.save()}>Save</Button>
</>
Multiple errors can be returned, So we also have a provided type, that can be used to help with the ErrorMessage component
import { ErrorBagItem } from '[@livewiremesh](https://github.com/livewiremesh)/react/hooks/useErrorBag';
interface IError extends React.HTMLProps<HTMLParagraphElement> {
error?: ErrorBagItem;
}
const Error: React.FC<IError> = ({ message, error, className, ...props }) => {
if (!error) return null;
return (
<p className={cn('text-red-500 error', className)} {...props}>
{error &&
error.map((item) => (
<span key={item} className="block">
{item}
</span>
))}
</p>
);
};
export default Error;
Updated useEntangle hook to accept generics for the data type.
const [count, setCount] = useEntangle<number>('count')
Full Changelog: https://github.com/EthanBarlo/LivewireMesh/compare/v0.5.4...v0.5.5
Full Changelog: https://github.com/EthanBarlo/LivewireMesh/compare/v0.5.2...v0.5.3
Full Changelog: https://github.com/EthanBarlo/LivewireMesh/commits/v0.5.1
Full Changelog: https://github.com/EthanBarlo/LivewireMesh/commits/v0.5.0
How can I help you explore Laravel packages today?