veza/.build/incus/web/js/chunk-wkfC2Tom.js
senke 1ed6e7f07b state-ownership: delete unused optimisticStoreUpdates.ts file
- Deleted apps/web/src/utils/optimisticStoreUpdates.ts (unused file)
- File was unused - no imports found in codebase
- Mutations already use React Query's onMutate pattern
- No TypeScript errors after deletion
- Actions 4.4.1.2 and 4.4.1.3 complete
2026-01-15 19:26:53 +01:00

6 lines
8.5 KiB
JavaScript

import{N}from"./chunk-Cad8leGS.js";import{j as P,p as U}from"./chunk-BoPufJSi.js";const L={},R=s=>{let l;const o=new Set,i=(d,g)=>{const m=typeof d=="function"?d(l):d;if(!Object.is(m,l)){const v=l;l=g??(typeof m!="object"||m===null)?m:Object.assign({},l,m),o.forEach(y=>y(l,v))}},t=()=>l,S={setState:i,getState:t,getInitialState:()=>f,subscribe:d=>(o.add(d),()=>o.delete(d)),destroy:()=>{(L?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),o.clear()}},f=l=s(i,t,S);return S},j=s=>s?R(s):R,D={},{useDebugValue:z}=N,{useSyncExternalStoreWithSelector:J}=P;let T=!1;const x=s=>s;function H(s,l=x,o){(D?"production":void 0)!=="production"&&o&&!T&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),T=!0);const i=J(s.subscribe,s.getState,s.getServerState||s.getInitialState,l,o);return z(i),i}const O=s=>{(D?"production":void 0)!=="production"&&typeof s!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const l=typeof s=="function"?j(s):s,o=(i,t)=>H(l,i,t);return Object.assign(o,l),o},K=s=>s?O(s):O,E={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_URL:"/api/v1",VITE_STREAM_URL:"/stream",VITE_UPLOAD_URL:"/upload",VITE_WS_URL:"/ws"},w=new Map,b=s=>{const l=w.get(s);return l?Object.fromEntries(Object.entries(l.stores).map(([o,i])=>[o,i.getState()])):{}},k=(s,l,o)=>{if(s===void 0)return{type:"untracked",connection:l.connect(o)};const i=w.get(o.name);if(i)return{type:"tracked",store:s,...i};const t={connection:l.connect(o),stores:{}};return w.set(o.name,t),{type:"tracked",store:s,...t}},F=(s,l={})=>(o,i,t)=>{const{enabled:e,anonymousActionType:h,store:u,...S}=l;let f;try{f=(e??(E?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!f)return(E?"production":void 0)!=="production"&&e&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),s(o,i,t);const{connection:d,...g}=k(u,f,S);let m=!0;t.setState=(r,a,c)=>{const n=o(r,a);if(!m)return n;const p=c===void 0?{type:h||"anonymous"}:typeof c=="string"?{type:c}:c;return u===void 0?(d?.send(p,i()),n):(d?.send({...p,type:`${u}/${p.type}`},{...b(S.name),[u]:t.getState()}),n)};const v=(...r)=>{const a=m;m=!1,o(...r),m=a},y=s(t.setState,i,t);if(g.type==="untracked"?d?.init(y):(g.stores[g.store]=t,d?.init(Object.fromEntries(Object.entries(g.stores).map(([r,a])=>[r,r===g.store?y:a.getState()])))),t.dispatchFromDevtools&&typeof t.dispatch=="function"){let r=!1;const a=t.dispatch;t.dispatch=(...c)=>{(E?"production":void 0)!=="production"&&c[0].type==="__setState"&&!r&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),r=!0),a(...c)}}return d.subscribe(r=>{var a;switch(r.type){case"ACTION":if(typeof r.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return I(r.payload,c=>{if(c.type==="__setState"){if(u===void 0){v(c.state);return}Object.keys(c.state).length!==1&&console.error(`
[zustand devtools middleware] Unsupported __setState action format.
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
`);const n=c.state[u];if(n==null)return;JSON.stringify(t.getState())!==JSON.stringify(n)&&v(n);return}t.dispatchFromDevtools&&typeof t.dispatch=="function"&&t.dispatch(c)});case"DISPATCH":switch(r.payload.type){case"RESET":return v(y),u===void 0?d?.init(t.getState()):d?.init(b(S.name));case"COMMIT":if(u===void 0){d?.init(t.getState());return}return d?.init(b(S.name));case"ROLLBACK":return I(r.state,c=>{if(u===void 0){v(c),d?.init(t.getState());return}v(c[u]),d?.init(b(S.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return I(r.state,c=>{if(u===void 0){v(c);return}JSON.stringify(t.getState())!==JSON.stringify(c[u])&&v(c[u])});case"IMPORT_STATE":{const{nextLiftedState:c}=r.payload,n=(a=c.computedStates.slice(-1)[0])==null?void 0:a.state;if(!n)return;v(u===void 0?n:n[u]),d?.send(null,c);return}case"PAUSE_RECORDING":return m=!m}return}}),y},Q=F,I=(s,l)=>{let o;try{o=JSON.parse(s)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}o!==void 0&&l(o)};function M(s,l){let o;try{o=s()}catch{return}return{getItem:t=>{var e;const h=S=>S===null?null:JSON.parse(S,void 0),u=(e=o.getItem(t))!=null?e:null;return u instanceof Promise?u.then(h):h(u)},setItem:(t,e)=>o.setItem(t,JSON.stringify(e,void 0)),removeItem:t=>o.removeItem(t)}}const _=s=>l=>{try{const o=s(l);return o instanceof Promise?o:{then(i){return _(i)(o)},catch(i){return this}}}catch(o){return{then(i){return this},catch(i){return _(i)(o)}}}},W=(s,l)=>(o,i,t)=>{let e={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:a=>a,version:0,merge:(a,c)=>({...c,...a}),...l},h=!1;const u=new Set,S=new Set;let f;try{f=e.getStorage()}catch{}if(!f)return s((...a)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),o(...a)},i,t);const d=_(e.serialize),g=()=>{const a=e.partialize({...i()});let c;const n=d({state:a,version:e.version}).then(p=>f.setItem(e.name,p)).catch(p=>{c=p});if(c)throw c;return n},m=t.setState;t.setState=(a,c)=>{m(a,c),g()};const v=s((...a)=>{o(...a),g()},i,t);let y;const r=()=>{var a;if(!f)return;h=!1,u.forEach(n=>n(i()));const c=((a=e.onRehydrateStorage)==null?void 0:a.call(e,i()))||void 0;return _(f.getItem.bind(f))(e.name).then(n=>{if(n)return e.deserialize(n)}).then(n=>{if(n)if(typeof n.version=="number"&&n.version!==e.version){if(e.migrate)return e.migrate(n.state,n.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return n.state}).then(n=>{var p;return y=e.merge(n,(p=i())!=null?p:v),o(y,!0),g()}).then(()=>{c?.(y,void 0),h=!0,S.forEach(n=>n(y))}).catch(n=>{c?.(void 0,n)})};return t.persist={setOptions:a=>{e={...e,...a},a.getStorage&&(f=a.getStorage())},clearStorage:()=>{f?.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>r(),hasHydrated:()=>h,onHydrate:a=>(u.add(a),()=>{u.delete(a)}),onFinishHydration:a=>(S.add(a),()=>{S.delete(a)})},r(),y||v},$=(s,l)=>(o,i,t)=>{let e={storage:M(()=>localStorage),partialize:r=>r,version:0,merge:(r,a)=>({...a,...r}),...l},h=!1;const u=new Set,S=new Set;let f=e.storage;if(!f)return s((...r)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),o(...r)},i,t);const d=()=>{const r=e.partialize({...i()});return f.setItem(e.name,{state:r,version:e.version})},g=t.setState;t.setState=(r,a)=>{g(r,a),d()};const m=s((...r)=>{o(...r),d()},i,t);t.getInitialState=()=>m;let v;const y=()=>{var r,a;if(!f)return;h=!1,u.forEach(n=>{var p;return n((p=i())!=null?p:m)});const c=((a=e.onRehydrateStorage)==null?void 0:a.call(e,(r=i())!=null?r:m))||void 0;return _(f.getItem.bind(f))(e.name).then(n=>{if(n)if(typeof n.version=="number"&&n.version!==e.version){if(e.migrate)return[!0,e.migrate(n.state,n.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,n.state];return[!1,void 0]}).then(n=>{var p;const[C,A]=n;if(v=e.merge(A,(p=i())!=null?p:m),o(v,!0),C)return d()}).then(()=>{c?.(v,void 0),v=i(),h=!0,S.forEach(n=>n(v))}).catch(n=>{c?.(void 0,n)})};return t.persist={setOptions:r=>{e={...e,...r},r.storage&&(f=r.storage)},clearStorage:()=>{f?.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>y(),hasHydrated:()=>h,onHydrate:r=>(u.add(r),()=>{u.delete(r)}),onFinishHydration:r=>(S.add(r),()=>{S.delete(r)})},e.skipHydration||y(),v||m},B=(s,l)=>"getStorage"in l||"serialize"in l||"deserialize"in l?((E?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),W(s,l)):$(s,l),Y=B,q=s=>(l,o,i)=>(i.setState=(t,e,...h)=>{const u=typeof t=="function"?U(t):t;return l(u,e,...h)},s(i.setState,o,i)),Z=q;export{K as c,Q as d,Z as i,Y as p};
//# sourceMappingURL=chunk-wkfC2Tom.js.map