Skip to content

Conversation

@PatrykWalach
Copy link
Member

Rebase of #264

PatrykWalach and others added 30 commits November 12, 2024 20:50
What

- Fixes the vite-demo tsc command

How

- Added the -b flag. The tsc error was about an output file not matching an input file, so by building, we ensure everything is generated so the error doesn't pop up again. I don't pretend to entirely understand exactly why, but it does work and will check types on the demo!
- document `useImperativeReference` and mutations
- modify the pet demo to show the result of a mutation
Both are called with no parameters.

Update docs accordingly.
# fix: Add noUncheckedIndexAccess to tsconfig

## What
- Adds the `noUncheckedIndexAccess` option to the base `tsconfig.json` file
- Fixes the errors that appeared
- Resolves isographlabs#213 

## How
- Added line to the file
- Fixed issues primarily by throwing errors, as each area of the code expects it to exist and something is very wrong if it doesn't
- Loosened equality checks in some places so all falsey values are caught
- Changed a few `null`s to `undefined`s because accessing an index that doesn't exist (or accessing an array with `undefined` as an index value returns `undefined`)
rbalicki2 and others added 29 commits January 6, 2025 23:54
- in makeNetworkRequest, if we pass an onComplete, we read out the result (after normalizing the data.) This gets passed to the resolver (for eager resolvers) or to getOrCreateCachedComponent (for @component resolvers). That value gets passed to onComplete
- FetchOptions, as a result, must be generic, and that must be threaded through everywhere

Further improvements:

- makeNetworkRequest and read are doing some pretty redundant work... those should be combined
- if reading the read-out value is expensive, then there should be two onComplete's: onCompleteWithReadOutValue and onComplete. However, this can be added later (if necessary)
- We are not actively maintaining or working on the relay crates, so we're okay with suppressing things that aren't trivial fixes.
- do not use rust 1.75, since it is no longer supported (apparently!)
- do not install rust in a step where it was unneeded
- generate a JSON schema for `isograph.config.json`, which users can then refer to via `"$schema": "path to schema"` for some added type safety
- write the JSON schema file directly from rust. Turns out using `stdout > file` results in different behavior in Windows and Linux, which this should fix
- Add a magic `link` field that can be selected on any item, whose type is `Link`
- This is analogous to Relay's `__id` field
- This field is used internally by e.g. `asUser`, whose resolver is implemented as `data.__typename === 'User' ? data.link : null`
- Within the runtime store APIs, a `Link` is the data structure that is used to navigate between two items. e.g. the store might contain `{ Query: { pets: [{ __link: '0', __typename: 'Pet' }] }`. `{ __link: '0', __typename: 'Pet' }` is a `Link`
This converts NormalizationAst from NormalizationAstNode[] to object with kind: "NormalizationAst" so we can make it a union of NormalizationAstLoader and NormalizationAst in isographlabs#271
… void (isographlabs#286)

- add a no_babel_transform option to the config
- if this is set to true, then iso literals for entrypoints have type void (even though they will actually be a x => x)
- if this is set to true, then iso literals that are called (e.g. field definitions) will not throw an error
- this gives a better overall experience to folks that cannot use the babel transform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants