glacier

Keep your data fresh

Downloads
514
Stars
126
Committers
2

Bot releases are visible (Hide)

glacier - 1.4.0 - Results

Published by hazae41 over 1 year ago

BREAKING

  • Renamed Result to ResultInit

Non breaking

  • New Result type which follows wrapper.unwrap() pattern
  • Result.from(init) converts a ResultInit into a Result
  • Result.map(callback) maps the result data into another type
  • Result.unwrap() returns the data or throws the error
  • Result.rewrap(wrapper) transforms a wrapper (an object with unwrap()) into a Result
  • Result.wrap(callback) and Result.wrapSync(callback) can wrap a throwable callback into a Result

Fixes

  • Fixed a bug with normalization and storage
glacier - 1.3.0 - Safer lock management

Published by hazae41 over 1 year ago

NO BREAKING CHANGE

No new features or usage, lot of bugs were fixed but maybe new bugs arrived

glacier - 1.2.4 - Renamed things && Schemas early return

Published by hazae41 over 1 year ago

BREAKING

  • Renamed useQuery to useSchema (or useScrollSchema)
  • Renamed useSingleQuery to useQuery

NOT BREAKING

  • Allow schema factories to return undefined:
function getHello(socket?: WebSocket) {
  if (!socket) return

  return getSchema("hello", key => fetcher(key, socket))
}
glacier - 1.2.2 - Clean

Published by hazae41 over 1 year ago

BREAKING

  • Made Core fields private
glacier - 1.2.1 - ESNext

Published by hazae41 almost 2 years ago

  • removed tslib dependency
glacier - 1.2.0 - Improved type system

Published by hazae41 almost 2 years ago

  • BREAKING: error is no longer typed, it is always unknown, just like in a try-catch block
    Migration:
// previously
useSingleSchema<Data, Error, Key>(key, fetcher, params)

// now
useSingleSchema<Data, Key>(key, fetcher, params)
  • BREAKING: serializer and normalizer are no longer allowed in global params
  • less verbose type system
  • removed all any types
glacier - 1.1.14 - Fix optimistic

Published by hazae41 almost 2 years ago

  • Optimistics now rollback to realData
glacier - 1.1.13 - Fix for React strict mode

Published by hazae41 almost 2 years ago

  • Fixed core mounting in React strict mode
    • Fixed garbage collection
    • Maybe other bugs?
glacier - 1.1.12 - Rollup and updates

Published by hazae41 almost 2 years ago

  • Unified Rollup config
  • Updated deps
  • modified react peer dependenct to >=17
  • moved tslib as dependency
glacier - 1.1.8 - Stricter Result

Published by hazae41 almost 2 years ago

BREAKING CHANGE

  • Result<D,E> is now stricter, you can either have data but no error, or error but no data
async function fetcher(url: string) {
  // ✅
  return { data: { name: "John Smith" } }

  // ✅
  return { error: new Error() }

  // ❌
  return { data: { name: "John Smith" }, error: new Error() }
}
glacier - 1.1.6 - Added React Native example

Published by hazae41 almost 2 years ago

  • added Expo (React Native) example
glacier - 1.1.5

Published by hazae41 almost 2 years ago

moved test in another repo

glacier - 1.1.4

Published by hazae41 almost 2 years ago

glacier - 1.1.2 - The sandbox update

Published by hazae41 almost 2 years ago

  • Added CodeSandbox
glacier - 1.1.0 - The rename update

Published by hazae41 almost 2 years ago

BREAKING CHANGES

  • Renamed "Handle" to "Query"
  • Renamed "Object" to "Instance"
  • Renamed "use" to "useQuery"
  • Renamed "single" to "getSingleSchema"
  • Renamed "scroll" to "getScrollSchema"
  • Renamed "useSingle" to "useSingleQuery"
  • Renamed "useScroll" to "useScrollQuery"
  • XSWR. is no longer needed (but still works)

Schemas become:

function getHelloSchema() {
  return getSingleSchema<Hello>("/api/hello", fetchAsJson)
}

Mixtures become:

function useAutoFetchMixture(query: Query) {
  useFetch(query)
  useVisible(query)
  useOnline(query)
}

Mixes become:

function useHelloMix() {
  const query = useQuery(getHelloSchema, [])
  useAutoFetchMixture(query)
  return query
}
glacier - 1.0.95 - The second bundle update

Published by hazae41 about 2 years ago

NO BREAKING CHANGES

CHANGES

  • Removed bunchee in favor of rollup => less bugs
  • No longer bundled/minified => easier debugging
  • Added source maps => easier debugging
  • Moved tslib as peerDependency => reduced bundle size
glacier - 1.0.89 - The bundle update

Published by hazae41 about 2 years ago

NO BREAKING CHANGES

CHANGES

  • type: module in package.json
  • moved react as a peerDependency => reduced bundle size
glacier - 1.0.86 - The real update

Published by hazae41 about 2 years ago

CHANGES

  • Updaters now yield Result instead of State: only allows data, error, and times (e.g. can't modify aborter in yield)
  • Added new member realData in States, Handles and Objects: it allows you to get the real, non-optimistic data
glacier - 1.0.85 - The update

Published by hazae41 about 2 years ago

  • Updated deps
  • Cleaned tsconfig
  • Commits and releases are now GPG signed
glacier - 1.0.81 - The optimistic loop update

Published by hazae41 about 2 years ago

CHANGES

  • Update generator now can yield multiple optimistics:
user.update(async function* () {
  yield { data: "Naive optimistic data" } // data that we create on-the-fly from what we suppose it will look like
  const tx = await contract.doSomething(user.data) // make an Ethereum transaction
  yield { data: getUserDataFromLogs(tx) } // data that we expect before the transaction is mined
  const txr = await tx.wait() // wait for transaction mined
}, { timeout: 60 * 1000 })