@seedprotocol/sdk 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -999,7 +999,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
999
999
  renderValue: refResolvedDisplayValue,
1000
1000
  });
1001
1001
  if (propertyNameFromDb === 'storageTransactionId') {
1002
- const { Item } = yield import('./index-Cu0y-Vyn.js');
1002
+ const { Item } = yield import('./index-C5t1T2iY.js');
1003
1003
  const item = yield Item.find({
1004
1004
  seedLocalId,
1005
1005
  modelName: itemModelName,
@@ -1745,7 +1745,6 @@ class ItemProperty {
1745
1745
  }
1746
1746
  if (skipTransform && !this._alias) ;
1747
1747
  this._subject.next(renderValue);
1748
- eventEmitter.emit(`item.${itemModelName},${seedUid || seedLocalId}.update`);
1749
1748
  // this._lastRenderedValue = renderValue
1750
1749
  });
1751
1750
  this._service.start();
@@ -4319,7 +4318,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
4319
4318
  if (!models$1) {
4320
4319
  return;
4321
4320
  }
4322
- const { models: SeedModels } = yield import('./seed.schema.config-D7AhI8aC.js');
4321
+ const { models: SeedModels } = yield import('./seed.schema.config-Cp-DUNSB.js');
4323
4322
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
4324
4323
  let hasModelsInDb = false;
4325
4324
  const schemaDefsByModelName = new Map();
@@ -5783,11 +5782,11 @@ const globalMachine = setup({
5783
5782
  (_a) => __awaiter(void 0, [_a], void 0, function* ({ context }) {
5784
5783
  let SeedClass;
5785
5784
  if (context.environment === 'node') {
5786
- const { SeedNode } = yield import('./seed-7auWiC8E.js');
5785
+ const { SeedNode } = yield import('./seed-VcgMFZrT.js');
5787
5786
  SeedClass = SeedNode;
5788
5787
  }
5789
5788
  else {
5790
- const { SeedBrowser } = yield import('./seed-CiQDWpvn.js');
5789
+ const { SeedBrowser } = yield import('./seed-nWPHoYI5.js');
5791
5790
  SeedClass = SeedBrowser;
5792
5791
  }
5793
5792
  return SeedClass;
@@ -6189,6 +6188,7 @@ const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
6189
6188
  const [property, setProperty] = useImmer(undefined);
6190
6189
  const [isReadingFromDb, setIsReadingFromDb] = useState(false);
6191
6190
  const [isInitialized, setIsInitialized] = useState(false);
6191
+ const { internalStatus } = useGlobalServiceStatus();
6192
6192
  const value = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => {
6193
6193
  if (!snapshot || !snapshot.context) {
6194
6194
  return;
@@ -6196,13 +6196,16 @@ const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
6196
6196
  return snapshot.context.renderValue || snapshot.context.propertyValue;
6197
6197
  });
6198
6198
  const status = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => snapshot === null || snapshot === void 0 ? void 0 : snapshot.value);
6199
- useEffect(() => {
6200
- if (property && property.value !== value) {
6201
- readFromDb();
6202
- }
6203
- }, [property, value]);
6199
+ // useEffect(() => {
6200
+ // if (property && property.value !== value) {
6201
+ // readFromDb()
6202
+ // }
6203
+ // }, [property, value])
6204
6204
  const readFromDb = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
6205
- if (!isAppDbReady() || isReadingFromDb || (!seedLocalId && !seedUid)) {
6205
+ if (!isAppDbReady() ||
6206
+ internalStatus !== 'ready' ||
6207
+ isReadingFromDb ||
6208
+ (!seedLocalId && !seedUid)) {
6206
6209
  return;
6207
6210
  }
6208
6211
  setIsReadingFromDb(true);
@@ -6218,13 +6221,12 @@ const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
6218
6221
  }
6219
6222
  setProperty(() => foundProperty);
6220
6223
  setIsInitialized(true);
6221
- }), [isReadingFromDb]);
6224
+ }), []);
6222
6225
  useEffect(() => {
6223
- readFromDb();
6224
- }, []);
6225
- // TODO: How can we force a re-render when the property is updated?
6226
- // Right now, the value will trigger an update because it's using a selector
6227
- // and a change is pushed to the hook listener.
6226
+ if (internalStatus === 'ready') {
6227
+ readFromDb();
6228
+ }
6229
+ }, [internalStatus]);
6228
6230
  return {
6229
6231
  property,
6230
6232
  isInitialized,
@@ -6541,7 +6543,7 @@ const client = {
6541
6543
  console.error('fs listeners not ready during init');
6542
6544
  }
6543
6545
  globalService.send({ type: 'init', endpoints, models, addresses });
6544
- import('./seed.schema.config-D7AhI8aC.js').then(({ models }) => {
6546
+ import('./seed.schema.config-Cp-DUNSB.js').then(({ models }) => {
6545
6547
  for (const [key, value] of Object.entries(models)) {
6546
6548
  setModel(key, value);
6547
6549
  }
@@ -6598,4 +6600,4 @@ if (isNode()) {
6598
6600
  }
6599
6601
 
6600
6602
  export { CHILD_SNAPSHOT as C, GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_SEEDS as a, GET_SEED_IDS as b, GET_STORAGE_TRANSACTION_ID as c, GET_VERSIONS as d, GET_PROPERTIES as e, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as f, itemMachineAll as g, internalMachine as h, itemMachineSingle as i, isNode as j, isBrowser as k, isReactNative as l, ImageSrc as m, ItemProperty as n, useItem as o, useItemProperties as p, useCreateItem as q, useItemProperty as r, useDeleteItem as s, useGlobalServiceStatus as t, useItems as u, useServices as v, withSeed as w, getGlobalService as x, client as y, getCorrectId as z };
6601
- //# sourceMappingURL=index-DdDMDXe3.js.map
6603
+ //# sourceMappingURL=index-BgZMod4t.js.map