Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

John/examples #62

Merged
merged 33 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
82e0763
type safety to event.queryHash
johnwdunn20 May 17, 2024
e4cfcc9
added additional type safety to createDisplayArray
johnwdunn20 May 17, 2024
b2124b9
added additional safety to app.tsx
johnwdunn20 May 17, 2024
3716279
updated chrome extension version
johnwdunn20 May 17, 2024
ee03513
added additional null checks in npm package
johnwdunn20 May 17, 2024
2fd6c76
updated versions
johnwdunn20 May 17, 2024
39dbdb8
added tanstack examples
johnwdunn20 May 17, 2024
ede55d7
ran example
johnwdunn20 May 17, 2024
086bacb
changes
johnwdunn20 May 17, 2024
4f2794c
changes
johnwdunn20 May 17, 2024
e326c61
Merge pull request #60 from oslabs-beta/dev
austin-cavanagh May 18, 2024
be727a4
setting up basic-typescript example to work locally
johnwdunn20 May 19, 2024
3edc761
changes for basic typescript example
johnwdunn20 May 19, 2024
7243538
updated package to have an error boundary
johnwdunn20 May 19, 2024
ff5b810
changes
johnwdunn20 May 19, 2024
993d077
added additional validation in app for data coming from npm pacakge a…
johnwdunn20 May 19, 2024
760aeb2
improved error boundary formatting
johnwdunn20 May 20, 2024
f7f6636
cleaned up example
johnwdunn20 May 20, 2024
fd618d0
additional notes in app.tsx in extension
johnwdunn20 May 20, 2024
05f497e
additional notes in app.tsx in extension
johnwdunn20 May 20, 2024
02e10f7
updated error message wording
johnwdunn20 May 20, 2024
0c0ba85
updated error message
johnwdunn20 May 20, 2024
aa7ad85
confirmed basic-typescript works
johnwdunn20 May 20, 2024
c1bf3e1
tested with algolia
johnwdunn20 May 20, 2024
8a649bb
set up basic example
johnwdunn20 May 20, 2024
99b58d8
tested basic
johnwdunn20 May 20, 2024
36465d9
cleaned up app.tsx
johnwdunn20 May 20, 2024
3cb38cc
updated dev steps
johnwdunn20 May 20, 2024
b8ea1eb
console logs
johnwdunn20 May 20, 2024
d07cf8b
added comprehensive gitignore file due to tanstack examples
johnwdunn20 May 20, 2024
a310176
tested on pagination example
johnwdunn20 May 20, 2024
c64f83f
merged latest
johnwdunn20 May 20, 2024
1f4746c
Merge branch 'dev' into john/examples
johnwdunn20 May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
198 changes: 197 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,199 @@
node_modules/
dist
coverage/
coverage/
.next/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Meteor
.meteor/local

# Gyp specific files
gyp-mac-tool
.gyp

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Sass
.sass-cache/

# FuseBox cache
.fusebox/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.test
.env.production

# Next.js
.next/
out/

# Next.js build output
.next/static/*
!.next/static/images
*.next/static/favicon.ico
.next/static/media/*

# Next.js cache
.next/cache/

# Nuxt.js build output
.nuxt/
dist/

# Gatsby files
.cache/
public/

# Expo
.expo/
.expo-shared/

# VS Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# IntelliJ IDEA
.idea/

# JetBrains Rider
.idea/

# WebStorm
.idea/

# PHPStorm
.idea/

# Android Studio
.idea/

# macOS
*.DS_Store
*.AppleDouble
*.LSOverride

# Thumbnails
._*

# Files that might appear on external disks
.Spotlight-V100
.Trashes

# Compiled Java classes
*.class

# Java JAR files
*.jar

# Java WAR files
*.war

# Java EAR files
*.ear

# NetBeans
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

# Maven
target/

# Gradle
.gradle/
build/

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files
*.swp
*.swo

# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "React Query Rewind",
"description": "State Management DevTool for React Query",
"version": "1.0",
"version": "2.1.0",
"permissions": ["activeTab", "storage", "scripting"],
"host_permissions": ["<all_urls>"],
"background": {
Expand Down
13 changes: 11 additions & 2 deletions extension/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ function App() {
port.onMessage.addListener(message => {
// console.log('DEVTOOL: Recieved message from background.ts', message);

if (message.type === 'event') {
// By checking data more thoroughly, we can avoid adding data that we don't expect in child components. This is the data we have the least control over.
// Future iteration could use Zod or something a little less manual and be a more prcise
console.log('Recieved event message', message)
if (
message.type === 'event' &&
message.payload &&
typeof message.payload.eventType === 'string' &&
Array.isArray(message.payload.queryKey) &&
typeof message.payload.queryHash === 'string'
) {
setQueryEvents(queryEvents => [...queryEvents, message.payload]);
}

if (message.type === 'tree') {
if (message.type === 'tree' && message?.data) {
// console.log('APP.tsx: Recieved tree data', message);
setTreeData(message.data);
}
Expand Down
2 changes: 1 addition & 1 deletion extension/src/components/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function MultiSelect({
const [queryOptions, setQueryOptions] = useState<string[]>([]);

useEffect(() => {
const newQueryOptions = queryEvents.map((event) => event.queryHash);
const newQueryOptions = queryEvents.map((event) => event?.queryHash);
const uniqueQueryOptions = Array.from(new Set(newQueryOptions));
setQueryOptions(uniqueQueryOptions);
// when there are new query options, we need to check with local storage and see if any of them are set
Expand Down
4 changes: 2 additions & 2 deletions extension/src/functions/createDisplayArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const createDisplayArray = (

// filter for events of selected queries
const selectedQueryEvents = queryEvents.filter((queryEvent) =>
selectedQueries.includes(queryEvent.queryHash)
selectedQueries.includes(queryEvent?.queryHash)
);

// traverse queries and update the relevant query data for that event
selectedQueryEvents.forEach((queryEvent) => {
const prevDisplay = [...allDisplays[allDisplays.length - 1]];
const newDisplay = prevDisplay.map((display) => {
if (display.queryKey === queryEvent.queryHash) {
if (display.queryKey === queryEvent?.queryHash) {
return { ...display, queryData: queryEvent.queryData };
}
return display;
Expand Down
2 changes: 1 addition & 1 deletion extension/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type JsonDiffType = {
// variable types
export type QueryEvent = {
eventType: string;
queryKey: string[];
queryKey: (string | number) [];
queryHash: string;
timestamp: Date;
queryData?: any;
Expand Down
99 changes: 99 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading